LocalizedRoutesAsPathTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
  3. class LocalizedRoutesAsPathTest extends WebTestCase
  4. {
  5. /**
  6. * @dataProvider getLocales
  7. */
  8. public function testLoginLogoutProcedure($locale)
  9. {
  10. $client = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => 'localized_routes.yml'));
  11. $client->insulate();
  12. $crawler = $client->request('GET', '/'.$locale.'/login');
  13. $form = $crawler->selectButton('login')->form();
  14. $form['_username'] = 'johannes';
  15. $form['_password'] = 'test';
  16. $client->submit($form);
  17. $this->assertRedirect($client->getResponse(), '/'.$locale.'/profile');
  18. $this->assertEquals('Profile', $client->followRedirect()->text());
  19. $client->request('GET', '/'.$locale.'/logout');
  20. $this->assertRedirect($client->getResponse(), '/'.$locale.'/');
  21. $this->assertEquals('Homepage', $client->followRedirect()->text());
  22. }
  23. public function getLocales()
  24. {
  25. return array(array('en'), array('de'));
  26. }
  27. protected function setUp()
  28. {
  29. parent::setUp();
  30. $this->deleteTmpDir('StandardFormLogin');
  31. }
  32. protected function tearDown()
  33. {
  34. parent::setUp();
  35. $this->deleteTmpDir('StandardFormLogin');
  36. }
  37. }