From 1d780fb7e93a87d8e51e85b121f81a8bf3d7ac50 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Wed, 3 May 2017 14:01:06 +0100 Subject: [PATCH] Revert "Issue #2827014 by michielnugter, cilefen, dawehner, xjm: Throw an exception when testing non response body in javascript tests" This reverts commit f1b5e6715202feea41647a9e8974d0eb1c6d13c4. --- .../Core/Session/SessionTest.php | 3 + .../FunctionalJavascriptTests/JSWebAssert.php | 56 ------------------- core/tests/Drupal/Tests/BrowserTestBase.php | 2 + 3 files changed, 5 insertions(+), 56 deletions(-) diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php index fa2d541c8a8b..e02e0dfb0f02 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php @@ -48,10 +48,13 @@ public function testSessionExpiration() { // number of times. $this->drupalGet('<front>'); + $session_assert = $this->assertSession(); + $page = $this->getSession()->getPage(); for ($i = 0; $i < 25; $i++) { $page->clickLink('Link to front page'); + $session_assert->statusCodeEquals(200); } } diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php index 94b5d4cec987..81d379f915bf 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php @@ -366,60 +366,4 @@ function t(r, lx, ly) { return $this->session->evaluateScript($full_javascript_visibility_test); } - /** - * The use of statusCodeEquals() is not available. - * - * @param int $code - * The status code. - * - * @throws \Behat\Mink\Exception\UnsupportedDriverActionException - * Throws an exception on use. - */ - public function statusCodeEquals($code) { - throw new UnsupportedDriverActionException('The use of statusCodeEquals() is not available in a functional JavaScript test.'); - } - - /** - * The use of statusCodeNotEquals() is not available. - * - * @param int $code - * The status code. - * - * @throws \Behat\Mink\Exception\UnsupportedDriverActionException - * Throws an exception on use. - */ - public function statusCodeNotEquals($code) { - throw new UnsupportedDriverActionException('The use of statusCodeNotEquals() is not available in a functional JavaScript test.'); - } - - /** - * The use of responseHeaderEquals() is not available. - * - * @param string $name - * The name of the header. - * @param string $value - * The value to check the header against. - * - * @throws \Behat\Mink\Exception\UnsupportedDriverActionException - * Throws an exception on use. - */ - public function responseHeaderEquals($name, $value) { - throw new UnsupportedDriverActionException('The use of responseHeaderEquals() is not available in a functional JavaScript test.'); - } - - /** - * The use of responseHeaderNotEquals() is not available. - * - * @param string $name - * The name of the header. - * @param string $value - * The value to check the header against. - * - * @throws \Behat\Mink\Exception\UnsupportedDriverActionException - * Throws an exception on use. - */ - public function responseHeaderNotEquals($name, $value) { - throw new UnsupportedDriverActionException('The use of responseHeaderNotEquals() is not available in a functional JavaScript test.'); - } - } diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 533e974512df..5751368f615c 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -715,6 +715,7 @@ protected function drupalLogin(AccountInterface $account) { } $this->drupalGet('user/login'); + $this->assertSession()->statusCodeEquals(200); $this->submitForm([ 'name' => $account->getUsername(), 'pass' => $account->passRaw, @@ -739,6 +740,7 @@ protected function drupalLogout() { // screen. $assert_session = $this->assertSession(); $this->drupalGet('user/logout', ['query' => ['destination' => 'user']]); + $assert_session->statusCodeEquals(200); $assert_session->fieldExists('name'); $assert_session->fieldExists('pass'); -- GitLab