|
@@ -17,6 +17,10 @@ class FormLoginTest extends WebTestCase
|
|
|
$client->submit($form);
|
|
|
|
|
|
$this->assertRedirect($client->getResponse(), '/');
|
|
|
+
|
|
|
+ $text = $client->followRedirect()->text();
|
|
|
+ $this->assertContains('Hello johannes!', $text);
|
|
|
+ $this->assertContains('You\'re browsing to path "/".', $text);
|
|
|
}
|
|
|
|
|
|
public function testFormLoginWithCustomTargetPath()
|
|
@@ -30,11 +34,34 @@ class FormLoginTest extends WebTestCase
|
|
|
$client->submit($form);
|
|
|
|
|
|
$this->assertRedirect($client->getResponse(), '/foo');
|
|
|
+
|
|
|
+ $text = $client->followRedirect()->text();
|
|
|
+ $this->assertContains('Hello johannes!', $text);
|
|
|
+ $this->assertContains('You\'re browsing to path "/foo".', $text);
|
|
|
}
|
|
|
|
|
|
- protected function tearDown()
|
|
|
+ public function testFormLoginRedirectsToProtectedResourceAfterLogin()
|
|
|
{
|
|
|
- parent::tearDown();
|
|
|
+ $client = $this->createClient(array('test_case' => 'StandardFormLogin'));
|
|
|
+
|
|
|
+ $client->request('GET', '/protected-resource');
|
|
|
+ $this->assertRedirect($client->getResponse(), '/login');
|
|
|
+
|
|
|
+ $form = $client->followRedirect()->selectButton('login')->form();
|
|
|
+ $form['_username'] = 'johannes';
|
|
|
+ $form['_password'] = 'test';
|
|
|
+ $client->submit($form);
|
|
|
+ $this->assertRedirect($client->getResponse(), '/protected-resource');
|
|
|
+
|
|
|
+ $text = $client->followRedirect()->text();
|
|
|
+ $this->assertContains('Hello johannes!', $text);
|
|
|
+ $this->assertContains('You\'re browsing to path "/protected-resource".', $text);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected function setUp()
|
|
|
+ {
|
|
|
+ parent::setUp();
|
|
|
+
|
|
|
$this->deleteTmpDir('StandardFormLogin');
|
|
|
}
|
|
|
}
|