I've been trying to write simple login test and this is my action ( the data should log me in ):
$client = self::createClient();
$crawler = $client->request('GET', '/login');
$form = $crawler->selectButton('Submit')->form();
$form['_username'] = 'admin';
$form['_password'] = 'adminpass';
$client->submit($form);
//$crawler = $client->followRedirect();
$this->assertEquals('Portal\FrontendBundle\Controller\ProfileController::indexAction', $client->getRequest()->attributes->get('_controller'));
And it stops on checkAction:
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Portal\FrontendBundle\Controller\ProfileController::indexAction'
+'FOS\UserBundle\Controller\SecurityController::checkAction'
C:\xampp\htdocs\portal\src\Portal\FrontendBundle\Tests\Controller\DefaultControllerTest.php:24
If I'm following redirect than it comes back to loginAction.
I'm new to Unit tests actually and I don't really know how I'm supposed to write it properly.