HI,
I'm newbie to testing. I have been using PHPUnit for my PHP web application. I could test my webpages with selenium-RC. Can I test on database ? Say, I have products table, if there is any filter (category wise, title wise) in my webpage which would filter products by category & title. How can I test this filter is working properly or not? This is just sample case, I have many cases in my web-application.
If PHPUnit is not efficient for database testing, could anyone suggest you the efficient test tool.
PHPUnit - Database testing
Moderator: General Moderators
-
archanab25
- Forum Newbie
- Posts: 2
- Joined: Mon Aug 31, 2009 4:33 am
Re: PHPUnit - Database testing
Hi, As I'm pretty new to database testing, I don't know how to prepare "database states"? In my site, mysql database is used.
When I searched, I found some code, but my database type is mysql not pdo_mysql.
How should I modify & how to test my requirement as I asked in my first post?
When I searched, I found some code, but my database type is mysql not pdo_mysql.
Code: Select all
class BankAccountDBTest extends PHPUnit_Extensions_Database_TestCase
{
protected $pdo;
public function __construct()
{
$this->pdo = new PDO('mysql::memory:');
BankAccount::createTable($this->pdo);
}
protected function getConnection()
{
return $this->createDefaultDBConnection($this->pdo, 'mysql');
}
.........................
}