You are here

public function HistoryTest::testForward 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::testForward()

File

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

Class

HistoryTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

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