public function ClientTest::testSubmitPreserveAuth in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/browser-kit/Tests/ClientTest.php \Symfony\Component\BrowserKit\Tests\ClientTest::testSubmitPreserveAuth()
File
- vendor/
symfony/ browser-kit/ Tests/ ClientTest.php, line 317
Class
Namespace
Symfony\Component\BrowserKit\TestsCode
public function testSubmitPreserveAuth() {
$client = new TestClient(array(
'PHP_AUTH_USER' => 'foo',
'PHP_AUTH_PW' => 'bar',
));
$client
->setNextResponse(new Response('<html><form action="/foo"><input type="submit" /></form></html>'));
$crawler = $client
->request('GET', 'http://www.example.com/foo/foobar');
$server = $client
->getRequest()
->getServer();
$this
->assertArrayHasKey('PHP_AUTH_USER', $server);
$this
->assertEquals('foo', $server['PHP_AUTH_USER']);
$this
->assertArrayHasKey('PHP_AUTH_PW', $server);
$this
->assertEquals('bar', $server['PHP_AUTH_PW']);
$client
->submit($crawler
->filter('input')
->form());
$this
->assertEquals('http://www.example.com/foo', $client
->getRequest()
->getUri(), '->submit() submit forms');
$server = $client
->getRequest()
->getServer();
$this
->assertArrayHasKey('PHP_AUTH_USER', $server);
$this
->assertEquals('foo', $server['PHP_AUTH_USER']);
$this
->assertArrayHasKey('PHP_AUTH_PW', $server);
$this
->assertEquals('bar', $server['PHP_AUTH_PW']);
}