diff --git a/core/modules/rest/src/Tests/UpdateTest.php b/core/modules/rest/src/Tests/UpdateTest.php index ef18a74..8d52f0e 100644 --- a/core/modules/rest/src/Tests/UpdateTest.php +++ b/core/modules/rest/src/Tests/UpdateTest.php @@ -166,6 +166,7 @@ public function testPatchUpdate() { * Tests several valid and invalid update requests for the 'user' entity type. */ public function testUpdateUser() { + $this->guzzle = TRUE; $serializer = $this->container->get('serializer'); $entity_type = 'user'; // Enables the REST service for 'user' entity type. @@ -190,7 +191,7 @@ public function testUpdateUser() { $error = Json::decode($response); $this->assertEqual($error['error'], "Unprocessable Entity: validation failed.\nmail: Your current password is missing or incorrect; it's required to change the Email.\n"); - // Try and send the new email with a password. + // Try and send the new email with a wrong password. $normalized['pass'][0]['existing'] = 'wrong'; $serialized = $serializer->serialize($normalized, $this->defaultFormat, $context); $response = $this->httpRequest($account->urlInfo(), 'PATCH', $serialized, $this->defaultMimeType); diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index a3bfd4c..8fae81a 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -121,6 +121,13 @@ protected $loggedInUser = FALSE; /** + * Guzzle Test. + * + * @var \Drupal\Core\Session\AccountInterface|bool + */ + protected $guzzle = FALSE; + + /** * The "#1" admin user. * * @var \Drupal\Core\Session\AccountInterface @@ -503,7 +510,12 @@ protected function drupalLogout() { // Make a request to the logout page, and redirect to the user page, the // idea being if you were properly logged out you should be seeing a login // screen. - $this->drupalGet('user/logout', array('query' => array('destination' => 'user/login'))); + + if ($this->guzzle) { + $this->httpRequest('user/logout', 'GET'); + } else { + $this->drupalGet('user/logout', array('query' => array('destination' => 'user/login'))); + } $this->assertResponse(200, 'User was logged out.'); $pass = $this->assertField('name', 'Username field found.', 'Logout'); $pass = $pass && $this->assertField('pass', 'Password field found.', 'Logout');