diff --git a/core/modules/contact/src/Tests/ContactAuthenticatedUserTest.php b/core/modules/contact/tests/src/Functional/ContactAuthenticatedUserTest.php similarity index 84% rename from core/modules/contact/src/Tests/ContactAuthenticatedUserTest.php rename to core/modules/contact/tests/src/Functional/ContactAuthenticatedUserTest.php index eb7c527..4b4a520 100644 --- a/core/modules/contact/src/Tests/ContactAuthenticatedUserTest.php +++ b/core/modules/contact/tests/src/Functional/ContactAuthenticatedUserTest.php @@ -1,15 +1,15 @@ drupalGet('user/' . $this->contactUser->id() . '/contact'); $this->assertEscaped($mail); $message = $this->submitPersonalContact($this->contactUser); - $mails = $this->drupalGetMails(); + $mails = $this->getMails(); $this->assertEqual(1, count($mails)); $mail = $mails[0]; $this->assertEqual($mail['to'], $this->contactUser->getEmail()); diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php similarity index 97% rename from core/modules/contact/src/Tests/ContactSitewideTest.php rename to core/modules/contact/tests/src/Functional/ContactSitewideTest.php index c148715..0f27086 100644 --- a/core/modules/contact/src/Tests/ContactSitewideTest.php +++ b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php @@ -1,13 +1,14 @@ xpath('//table/tbody/tr') as $row) { - if (((string) $row->td[0]->a) == $label) { + foreach ($this->xpath('//table/tbody/tr/td[1]/a') as $row_link) { + if ($row_link->getText() == $label) { break; } $i++; @@ -294,7 +296,7 @@ function testSiteWideContact() { $field_name . '[0][value]' => $this->randomMachineName(), ); $this->drupalPostForm(NULL, $edit, t('Send message')); - $mails = $this->drupalGetMails(); + $mails = $this->getMails(); $mail = array_pop($mails); $this->assertEqual($mail['subject'], t('[@label] @subject', array('@label' => $label, '@subject' => $edit['subject[0][value]']))); $this->assertTrue(strpos($mail['body'], $field_label)); @@ -366,7 +368,7 @@ function testAutoReply() { $this->submitContact($this->randomMachineName(16), $email, $subject, 'foo', $this->randomString(128)); // We are testing the auto-reply, so there should be one email going to the sender. - $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email)); + $captured_emails = $this->getMails(array('id' => 'contact_page_autoreply', 'to' => $email)); $this->assertEqual(count($captured_emails), 1); $this->assertEqual(trim($captured_emails[0]['body']), trim(MailFormatHelper::htmlToText($foo_autoreply))); @@ -375,14 +377,14 @@ function testAutoReply() { $this->submitContact($this->randomMachineName(16), $email, $this->randomString(64), 'bar', $this->randomString(128)); // Auto-reply for form 'bar' should result in one auto-reply email to the sender. - $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email)); + $captured_emails = $this->getMails(array('id' => 'contact_page_autoreply', 'to' => $email)); $this->assertEqual(count($captured_emails), 1); $this->assertEqual(trim($captured_emails[0]['body']), trim(MailFormatHelper::htmlToText($bar_autoreply))); // Verify that no auto-reply is sent when the auto-reply field is left blank. $email = $this->randomMachineName(32) . '@example.com'; $this->submitContact($this->randomMachineName(16), $email, $this->randomString(64), 'no_autoreply', $this->randomString(128)); - $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email)); + $captured_emails = $this->getMails(array('id' => 'contact_page_autoreply', 'to' => $email)); $this->assertEqual(count($captured_emails), 0); } diff --git a/core/modules/contact/src/Tests/ContactStorageTest.php b/core/modules/contact/tests/src/Functional/ContactStorageTest.php similarity index 98% rename from core/modules/contact/src/Tests/ContactStorageTest.php rename to core/modules/contact/tests/src/Functional/ContactStorageTest.php index ad0e8d4..f32233a 100644 --- a/core/modules/contact/src/Tests/ContactStorageTest.php +++ b/core/modules/contact/tests/src/Functional/ContactStorageTest.php @@ -1,6 +1,6 @@ drupalGetHeader('X-Drupal-Cache-Contexts')); - $this->assertTrue(in_array($expected_cache_context, $cache_contexts), "'" . $expected_cache_context . "' is present in the X-Drupal-Cache-Contexts header."); - } - - /** - * Asserts that a cache context was not present in the last response. - * - * @param string $not_expected_cache_context - * The expected cache context. - */ - protected function assertNoCacheContext($not_expected_cache_context) { - $cache_contexts = explode(' ', $this->drupalGetHeader('X-Drupal-Cache-Contexts')); - $this->assertFalse(in_array($not_expected_cache_context, $cache_contexts), "'" . $not_expected_cache_context . "' is not present in the X-Drupal-Cache-Contexts header."); - } - - /** * Asserts whether an expected cache tag was present in the last response. * * @param string $expected_cache_tag diff --git a/core/modules/simpletest/tests/src/Functional/BrowserTestBaseTest.php b/core/modules/simpletest/tests/src/Functional/BrowserTestBaseTest.php index 5c1e3f5..af72836 100644 --- a/core/modules/simpletest/tests/src/Functional/BrowserTestBaseTest.php +++ b/core/modules/simpletest/tests/src/Functional/BrowserTestBaseTest.php @@ -32,11 +32,19 @@ public function testGoTo() { // Test page contains some text. $this->assertSession()->pageTextContains('Test page text.'); + // Make sure CSS