コントローラからフラッシュメッセージがセットされて表示されるようにしたいのですが
テストを実行した時に表示されません。
試してみたサンプルです。
lang
1public function testHogefugaLogin() 2{ 3 $session = $this->client->getContainer()->get('session'); 4 $crawler = $this->client->request('GET', '/login'); 5 6 $this->assertTrue($this->client->getResponse()->isSuccessful()); 7 $form = $crawler->filter('form'); 8 $this->assertGreaterThan(0, $form->count()); 9 10 $form = $form->form(); 11 $this->assertNotEmpty($form); 12 13 $form['_hogemane'] = 'hogemane'; 14 $form['_password'] = 'password'; 15 16 $this->client->submit($form); 17 $this->assertTrue($this->client->getResponse()->isRedirect('http://localhost/login')); 18 $this->client->followRedirect(); 19 20 $session = $this->client->getContainer()->get('session'); 21 var_dump($session->getBag('flashes')->all()); 22}
Flashメッセージをテストするにはどうすればいいでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。