アプリケーションの機能テストに liip-functional-test バンドルを使用しています。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 ファイルからテスト データベースの構成をコメントすると、テストは正常に実行されます。私が欲しいのは次のようなものです: テストデータベースにフィクスチャを書き、実際のデータベースでアサートやその他のテストを実行します