diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index 5a16556..c92fac1 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -26,6 +26,7 @@ function contact_help($path, $arg) { $output .= '
' . t('If you would like additional text to appear on the site-wide or personal contact page, use a block. You can create and edit blocks on the Blocks administration page.', array('@blocks' => url('admin/structure/block'))) . '
'; $output .= ''; return $output; + case 'admin/structure/contact': $output = '

' . t('Add one or more categories on this page to set up your site-wide contact form.', array('@form' => url('contact'))) . '

'; $output .= '

' . t('A Contact menu item is added to the Footer menu, which you can modify on the Menus administration page.', array('@menu-settings' => url('admin/structure/menu'))) . '

'; diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php index 19713b9..594f9fe 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php @@ -54,40 +54,48 @@ class ContactPersonalTest extends WebTestBase { ); } - function setUp() { + /** + * {@inheritdoc} + */ + public function setUp() { parent::setUp(); // Create an admin user. - $this->admin_user = $this->drupalCreateUser(array('administer contact forms', 'administer users', 'administer account settings', 'access site reports')); + $this->admin_user = $this->drupalCreateUser(array( + 'administer contact forms', + 'administer users', + 'administer account settings', + 'access site reports', + )); // Create some normal users with their contact forms enabled by default. \Drupal::config('contact.settings')->set('user_default_enabled', 1)->save(); - $this->web_user = $this->drupalCreateUser(array('access user contact forms')); - $this->contact_user = $this->drupalCreateUser(); + $this->webUser = $this->drupalCreateUser(array('access user contact forms')); + $this->contactUser = $this->drupalCreateUser(); } /** * Tests that mails for contact messages are correctly sent. */ - function testSendPersonalContactMessage() { - $this->drupalLogin($this->web_user); + public function testSendPersonalContactMessage() { + $this->drupalLogin($this->webUser); - $message = $this->submitPersonalContact($this->contact_user); + $message = $this->submitPersonalContact($this->contactUser); $mails = $this->drupalGetMails(); $this->assertEqual(1, count($mails)); $mail = $mails[0]; - $this->assertEqual($mail['to'], $this->contact_user->getEmail()); + $this->assertEqual($mail['to'], $this->contactUser->getEmail()); $this->assertEqual($mail['from'], \Drupal::config('system.site')->get('mail')); - $this->assertEqual($mail['reply-to'], $this->web_user->getEmail()); + $this->assertEqual($mail['reply-to'], $this->webUser->getEmail()); $this->assertEqual($mail['key'], 'user_mail'); $variables = array( '!site-name' => \Drupal::config('system.site')->get('name'), '!subject' => $message['subject'], - '!recipient-name' => $this->contact_user->getUsername(), + '!recipient-name' => $this->contactUser->getUsername(), ); $this->assertEqual($mail['subject'], t('[!site-name] !subject', $variables), 'Subject is in sent message.'); $this->assertTrue(strpos($mail['body'], t('Hello !recipient-name,', $variables)) !== FALSE, 'Recipient name is in sent message.'); - $this->assertTrue(strpos($mail['body'], $this->web_user->getUsername()) !== FALSE, 'Sender name is in sent message.'); + $this->assertTrue(strpos($mail['body'], $this->webUser->getUsername()) !== FALSE, 'Sender name is in sent message.'); $this->assertTrue(strpos($mail['body'], $message['message']) !== FALSE, 'Message body is in sent message.'); // Check there was no problems raised during sending. @@ -98,7 +106,7 @@ function testSendPersonalContactMessage() { $placeholders = array( '@sender_name' => $this->web_user->username, '@sender_email' => $this->web_user->getEmail(), - '@recipient_name' => $this->contact_user->getUsername() + '@recipient_name' => $this->contact_user->getUsername(), ); $this->assertText(String::format('@sender_name (@sender_email) sent @recipient_name an e-mail.', $placeholders)); } @@ -106,27 +114,27 @@ function testSendPersonalContactMessage() { /** * Tests access to the personal contact form. */ - function testPersonalContactAccess() { + public function testPersonalContactAccess() { // Test allowed access to admin user's contact form. - $this->drupalLogin($this->web_user); - $this->drupalGet('user/' . $this->admin_user->id() . '/contact'); + $this->drupalLogin($this->webUser); + $this->drupalGet('user/' . $this->adminUser->id() . '/contact'); $this->assertResponse(200); // Check the page title is properly displayed. - $this->assertRaw(t('Contact @username', array('@username' => $this->admin_user->getUsername()))); + $this->assertRaw(t('Contact @username', array('@username' => $this->adminUser->getUsername()))); // Test denied access to admin user's own contact form. $this->drupalLogout(); - $this->drupalLogin($this->admin_user); - $this->drupalGet('user/' . $this->admin_user->id() . '/contact'); + $this->drupalLogin($this->adminUser); + $this->drupalGet('user/' . $this->adminUser->id() . '/contact'); $this->assertResponse(403); // Test allowed access to user with contact form enabled. - $this->drupalLogin($this->web_user); - $this->drupalGet('user/' . $this->contact_user->id() . '/contact'); + $this->drupalLogin($this->webUser); + $this->drupalGet('user/' . $this->contactUser->id() . '/contact'); $this->assertResponse(200); // Test denied access to the user's own contact form. - $this->drupalGet('user/' . $this->web_user->id() . '/contact'); + $this->drupalGet('user/' . $this->webUser->id() . '/contact'); $this->assertResponse(403); // Test always denied access to the anonymous user contact form. diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php index c10629e..9a40242 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php @@ -131,7 +131,8 @@ class ContactSitewideTest extends WebTestBase { $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->id; $this->assertEqual($langcode, $default_langcode); - // Make sure the newly created category is included in the list of categories. + // Make sure the newly created category is included in + // the list of categories. $this->assertNoUniqueText($label, 'New category included in categories list.'); // Test update contact form category.