php - How to open browser for testing with DBUnit in CakePHP? -
i'm using cakephp , dbunit database testing. i'd achieve test whether form i've submitted on website, inserts data correctly db. have lot of ui tests, test page itself, i've small amount of db test:
<?php class testschema extends phpunit_extensions_database_testcase { /* ** @return phpunit_extensions_database_db_idatabaseconnection */ public function getconnection() { $pdo = new pdo('mysql:dbname=job_manager;host=localhost','root','toor'); $pdo->exec("set foreign_key_checks=0"); return $this->createdefaultdbconnection($pdo, 'job_manager'); } /* ** @return phpunit_extensions_database_dataset_idataset */ public function getdataset() { $cascadetruncates = true; return $this->createmysqlxmldataset(dirname(__file__).'/default.xml'); } public function testrowcounts() { $this->assertequals(3, $this->getconnection()->getrowcount('jobs')); $this->assertequals(1, $this->getconnection()->getrowcount('machines')); $this->assertequals(4, $this->getconnection()->getrowcount('users')); } } ?>
i've tried this:
$this->setbrowser('*firefox'); $this->setbrowserurl('url'); $this->open('link');
like did in ui tests, doesn't work (because class inherited phpunit_extensions_database_testcase , not phpunit_extensions_seleniumtestcase)
any ideas? thanks
my solution @ end (maybe can later):
at end i've created bash script, , execute ui test , db test after that. had modify db class such that:
public function getdataset() { $cascadetruncates = true; return $this->getconnection()->createdataset(); }
so gets dataset current db.
Comments
Post a Comment