You are here

public function HistoryTest::testBack in Zircon Profile 8

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

File

vendor/symfony/browser-kit/Tests/HistoryTest.php, line 65

Class

HistoryTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

public function testBack() {
  $history = new History();
  $history
    ->add(new Request('http://www.example.com/', 'get'));
  try {
    $history
      ->back();
    $this
      ->fail('->back() throws a \\LogicException if the history is already on the first page');
  } catch (\Exception $e) {
    $this
      ->assertInstanceOf('LogicException', $e, '->current() throws a \\LogicException if the history is already on the first page');
  }
  $history
    ->add(new Request('http://www.example1.com/', 'get'));
  $history
    ->back();
  $this
    ->assertSame('http://www.example.com/', $history
    ->current()
    ->getUri(), '->back() returns the previous request in the history');
}