我正在使用liip-functional-test bundle对我的应用程序进行功能测试。 我在config_test.php文件中配置了一个测试数据库:
doctrine:
dbal:
default_connection: default
connections:
default:
driver: %database_driver_sqlite%
path: %database_path%
当我运行我的测试时,我得到错误:在最后一行声明false为true失败
public function test()
{
$this->loadFixtures(array(
'UserBundle\DataFixtures\ORM\LoadUserData'
));
$client = static::makeClient(true,
array(
'HTTP_HOST' => 'mylocalhost'
));
$crawler = $client->request('GET', '/login');
$form = $crawler->selectButton('Login')->form(array(
'_username' => 'username',
'_password' => 'password',
),'POST');
echo ' TEST RESULT '.$client->getResponse()->getStatusCode().' ';
$client->submit($form);
$this->assertTrue($client->getResponse()->isRedirect());
$client->followRedirect();
echo ' TEST RESULT '.$client->getResponse()->getStatusCode().' ';
$crawler = $client->request('GET', '/another page');
$this->assertTrue($crawler->filter('html:contains("some_text_on_page")')->count() > 0);
如果我从config_test文件中评论测试数据库配置,我的测试运行正常。我想要的就是:在测试数据库中编写fixture并在真实数据库上运行asserts和其他测试