You are here

public function DrupalMinkClientTest::testBackForwardMetaRefresh in Drupal 8

@covers ::request

File

core/tests/Drupal/BuildTests/Framework/Tests/DrupalMinkClientTest.php, line 57

Class

DrupalMinkClientTest
Test \Drupal\BuildTests\Framework\DrupalMinkClient.

Namespace

Drupal\BuildTests\Framework\Tests

Code

public function testBackForwardMetaRefresh() {
  $client = new TestClient();
  $client
    ->followMetaRefresh();

  // First request.
  $client
    ->request('GET', 'http://www.example.com/first-page');
  $content = '<html><head><meta http-equiv="Refresh" content="0; URL=/refreshed" /></body></html>';
  $client
    ->setNextResponse(new Response($content, 200));
  $client
    ->request('GET', 'http://www.example.com/refresh-from-here');
  $this
    ->assertEquals('http://www.example.com/refreshed', $client
    ->getRequest()
    ->getUri());
  $client
    ->back();
  $this
    ->assertEquals('http://www.example.com/first-page', $client
    ->getRequest()
    ->getUri());
  $client
    ->forward();
  $this
    ->assertEquals('http://www.example.com/refreshed', $client
    ->getRequest()
    ->getUri());
}