diff --git a/core/modules/contact/tests/src/Functional/ContactLanguageTest.php b/core/modules/contact/tests/src/Functional/ContactLanguageTest.php index 47d1533..1fa8190 100644 --- a/core/modules/contact/tests/src/Functional/ContactLanguageTest.php +++ b/core/modules/contact/tests/src/Functional/ContactLanguageTest.php @@ -46,7 +46,7 @@ protected function setUp() { public function testContactLanguage() { // Ensure that contact form by default does not show the language select. $this->drupalGet('contact'); - $this->assertResponse(200, 'The page exists'); + $this->assertResponse(200); $this->assertNoField('edit-langcode-0-value'); // Enable language select from content language settings page. @@ -57,7 +57,7 @@ public function testContactLanguage() { // Ensure that contact form now shows the language select. $this->drupalGet('contact'); - $this->assertResponse(200, 'The page exists'); + $this->assertResponse(200); $this->assertField('edit-langcode-0-value'); } diff --git a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php index f8ca03e..9573206 100644 --- a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php +++ b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php @@ -16,9 +16,7 @@ */ class ContactPersonalTest extends BrowserTestBase { - use AssertMailTrait { - getMails as drupalGetMails; - } + use AssertMailTrait; /** * Modules to enable. @@ -72,7 +70,7 @@ function testSendPersonalContactMessage() { $this->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/tests/src/Functional/ContactSitewideTest.php b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php index 92dee6b..d092766 100644 --- a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php +++ b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php @@ -5,6 +5,7 @@ use Drupal\Component\Utility\Unicode; use Drupal\contact\Entity\ContactForm; use Drupal\Core\Mail\MailFormatHelper; +use Drupal\Core\Test\AssertMailTrait; use Drupal\field_ui\Tests\FieldUiTestTrait; use Drupal\Tests\BrowserTestBase; use Drupal\Core\Entity\EntityTypeInterface; @@ -20,6 +21,7 @@ class ContactSitewideTest extends BrowserTestBase { use FieldUiTestTrait; + use AssertMailTrait; /** * Modules to enable. @@ -33,9 +35,9 @@ class ContactSitewideTest extends BrowserTestBase { */ protected function setUp() { parent::setUp(); - $this->drupalPlaceBlock('system_breadcrumb_block'); - $this->drupalPlaceBlock('local_actions_block'); - $this->drupalPlaceBlock('page_title_block'); + $this->placeBlock('system_breadcrumb_block'); + $this->placeBlock('local_actions_block'); + $this->placeBlock('page_title_block'); } /** @@ -147,7 +149,7 @@ function testSiteWideContact() { $this->assertEqual($langcode, $default_langcode); // Make sure the newly created form is included in the list of forms. - $this->assertNoUniqueText($label, 'New form included in forms list.'); + $this->assertNoUniqueText($label); // Ensure that the recipient email is escaped on the listing. $this->drupalGet('admin/structure/contact'); @@ -293,7 +295,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)); @@ -325,7 +327,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))); @@ -334,14 +336,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/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 3beb32f..0d8c81b 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -43,9 +43,7 @@ */ abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase { use AssertHelperTrait; - use BlockCreationTrait { - placeBlock as drupalPlaceBlock; - } + use BlockCreationTrait; use AssertLegacyTrait; use RandomGeneratorTrait; use SessionTestTrait;