X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FRouting%2FDestinationTest.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Fsrc%2FTests%2FRouting%2FDestinationTest.php;h=109d8000074d954fad337b36b107bb6b585446c7;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=d959c7ad4aad806951357d14aa3d860817ea6ceb;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/modules/system/src/Tests/Routing/DestinationTest.php b/web/core/modules/system/tests/src/Functional/Routing/DestinationTest.php similarity index 76% rename from web/core/modules/system/src/Tests/Routing/DestinationTest.php rename to web/core/modules/system/tests/src/Functional/Routing/DestinationTest.php index d959c7ad4..109d80000 100644 --- a/web/core/modules/system/src/Tests/Routing/DestinationTest.php +++ b/web/core/modules/system/tests/src/Functional/Routing/DestinationTest.php @@ -1,9 +1,9 @@ getHttpClient(); + $session = $this->getSession(); + $test_cases = [ [ 'input' => 'node', @@ -61,10 +64,12 @@ class DestinationTest extends WebTestBase { foreach ($test_cases as $test_case) { // Test $_GET['destination']. $this->drupalGet('system-test/get-destination', ['query' => ['destination' => $test_case['input']]]); - $this->assertIdentical($test_case['output'], $this->getRawContent(), $test_case['message']); + $this->assertIdentical($test_case['output'], $session->getPage()->getContent(), $test_case['message']); // Test $_REQUEST['destination']. - $post_output = $this->drupalPost('system-test/request-destination', '*', ['destination' => $test_case['input']]); - $this->assertIdentical($test_case['output'], $post_output, $test_case['message']); + $post_output = $http_client->request('POST', $this->buildUrl('system-test/request-destination'), [ + 'form_params' => ['destination' => $test_case['input']], + ]); + $this->assertIdentical($test_case['output'], (string) $post_output->getBody(), $test_case['message']); } // Make sure that 404 pages do not populate $_GET['destination'] with @@ -72,7 +77,7 @@ class DestinationTest extends WebTestBase { \Drupal::configFactory()->getEditable('system.site')->set('page.404', '/system-test/get-destination')->save(); $this->drupalGet('http://example.com', ['external' => FALSE]); $this->assertResponse(404); - $this->assertIdentical(Url::fromRoute('')->toString(), $this->getRawContent(), 'External URL is not allowed on 404 pages.'); + $this->assertIdentical(Url::fromRoute('')->toString(), $session->getPage()->getContent(), 'External URL is not allowed on 404 pages.'); } }