You are here

public function ClientTest::testBack in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/browser-kit/Tests/ClientTest.php \Symfony\Component\BrowserKit\Tests\ClientTest::testBack()

File

vendor/symfony/browser-kit/Tests/ClientTest.php, line 495

Class

ClientTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

public function testBack() {
  $client = new TestClient();
  $parameters = array(
    'foo' => 'bar',
  );
  $files = array(
    'myfile.foo' => 'baz',
  );
  $server = array(
    'X_TEST_FOO' => 'bazbar',
  );
  $content = 'foobarbaz';
  $client
    ->request('GET', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
  $client
    ->request('GET', 'http://www.example.com/foo');
  $client
    ->back();
  $this
    ->assertEquals('http://www.example.com/foo/foobar', $client
    ->getRequest()
    ->getUri(), '->back() goes back in the history');
  $this
    ->assertArrayHasKey('foo', $client
    ->getRequest()
    ->getParameters(), '->back() keeps parameters');
  $this
    ->assertArrayHasKey('myfile.foo', $client
    ->getRequest()
    ->getFiles(), '->back() keeps files');
  $this
    ->assertArrayHasKey('X_TEST_FOO', $client
    ->getRequest()
    ->getServer(), '->back() keeps $_SERVER');
  $this
    ->assertEquals($content, $client
    ->getRequest()
    ->getContent(), '->back() keeps content');
}