Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / browser-kit / Tests / ClientTest.php
index 5bd4dad7b6ecba7051c33d4c6686d0db7f903db0..9c7267e83b721a05f9f86eb613fe39e318493d0d 100644 (file)
@@ -573,6 +573,25 @@ class ClientTest extends TestCase
         $this->assertEquals($content, $client->getRequest()->getContent(), '->forward() keeps content');
     }
 
+    public function testBackAndFrowardWithRedirects()
+    {
+        $client = new TestClient();
+
+        $client->request('GET', 'http://www.example.com/foo');
+        $client->setNextResponse(new Response('', 301, array('Location' => 'http://www.example.com/redirected')));
+        $client->request('GET', 'http://www.example.com/bar');
+
+        $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), 'client followed redirect');
+
+        $client->back();
+
+        $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->back() goes back in the history skipping redirects');
+
+        $client->forward();
+
+        $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->forward() goes forward in the history skipping redirects');
+    }
+
     public function testReload()
     {
         $client = new TestClient();