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/Access/ContactPageAccess.php b/core/modules/contact/lib/Drupal/contact/Access/ContactPageAccess.php index 548d1fa..12e11bb 100644 --- a/core/modules/contact/lib/Drupal/contact/Access/ContactPageAccess.php +++ b/core/modules/contact/lib/Drupal/contact/Access/ContactPageAccess.php @@ -80,7 +80,7 @@ class ContactPageAccess implements AccessInterface { } // If the requested user did not save a preference yet, deny access if the // configured default is disabled. - else if (!$this->configFactory->get('contact.settings')->get('user_default_enabled')) { + elseif (!$this->configFactory->get('contact.settings')->get('user_default_enabled')) { return static::DENY; } diff --git a/core/modules/contact/lib/Drupal/contact/Entity/Message.php b/core/modules/contact/lib/Drupal/contact/Entity/Message.php index 68352cb..ba4569a 100644 --- a/core/modules/contact/lib/Drupal/contact/Entity/Message.php +++ b/core/modules/contact/lib/Drupal/contact/Entity/Message.php @@ -118,7 +118,7 @@ class Message extends ContentEntityBase implements MessageInterface { * {@inheritdoc} */ public function copySender() { - return (bool)$this->get('copy')->value; + return (bool) $this->get('copy')->value; } /** diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php index da17847..0c945c8 100644 --- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php +++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php @@ -198,8 +198,8 @@ class MessageFormController extends ContentEntityFormController { $sender->mail = $message->getSenderMail(); // Save the anonymous user information to a cookie for reuse. user_cookie_save(array('name' => $message->getSenderName(), 'mail' => $message->getSenderMail())); - // For the e-mail message, clarify that the sender name is not verified; it - // could potentially clash with a username on this site. + // For the e-mail message, clarify that the sender name is not verified; + // it could potentially clash with a username on this site. $sender->name = t('!name (not verified)', array('!name' => $message->getSenderName())); } diff --git a/core/modules/contact/lib/Drupal/contact/Plugin/views/field/ContactLink.php b/core/modules/contact/lib/Drupal/contact/Plugin/views/field/ContactLink.php index e0daca3..28fe14b 100644 --- a/core/modules/contact/lib/Drupal/contact/Plugin/views/field/ContactLink.php +++ b/core/modules/contact/lib/Drupal/contact/Plugin/views/field/ContactLink.php @@ -44,6 +44,7 @@ class ContactLink extends Link { * \Drupal\Core\Plugin\PluginBase instead. * * @return \Drupal\Core\Session\AccountInterface + * returns the current active user. */ protected function currentUser() { if (!$this->currentUser) { diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactAuthenticatedUserTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactAuthenticatedUserTest.php index 059923f..a9e260d 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/ContactAuthenticatedUserTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactAuthenticatedUserTest.php @@ -21,6 +21,9 @@ class ContactAuthenticatedUserTest extends WebTestBase { */ public static $modules = array('contact'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Contact form textfields', @@ -32,7 +35,7 @@ class ContactAuthenticatedUserTest extends WebTestBase { /** * Tests that name and email fields are not present for authenticated users. */ - function testContactSiteWideTextfieldsLoggedInTestCase() { + public function testContactSiteWideTextfieldsLoggedInTestCase() { $this->drupalLogin($this->drupalCreateUser(array('access site-wide contact form'))); $this->drupalGet('contact'); diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php index f1df078..ccd1c42 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php @@ -27,22 +27,25 @@ class ContactPersonalTest extends WebTestBase { * * @var object */ - private $admin_user; + private $adminUser; /** * A user with 'access user contact forms' permission. * * @var object */ - private $web_user; + private $webUser; /** * A user without any permissions. * * @var object */ - private $contact_user; + private $contactUser; + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Personal contact form', @@ -51,51 +54,59 @@ 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->adminUser = $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. $this->drupalLogout(); - $this->drupalLogin($this->admin_user); + $this->drupalLogin($this->adminUser); // Verify that the correct watchdog message has been logged. $this->drupalGet('/admin/reports/dblog'); $placeholders = array( - '@sender_name' => $this->web_user->username, - '@sender_email' => $this->web_user->getEmail(), - '@recipient_name' => $this->contact_user->getUsername() + '@sender_name' => $this->webUser->username, + '@sender_email' => $this->webUser->getEmail(), + '@recipient_name' => $this->contactUser->getUsername(), ); $this->assertText(String::format('@sender_name (@sender_email) sent @recipient_name an e-mail.', $placeholders)); } @@ -103,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. @@ -133,22 +144,22 @@ function testPersonalContactAccess() { // Test that anonymous users can access the contact form. $this->drupalLogout(); user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access user contact forms')); - $this->drupalGet('user/' . $this->contact_user->id() . '/contact'); + $this->drupalGet('user/' . $this->contactUser->id() . '/contact'); $this->assertResponse(200); // Test that anonymous users can access admin user's contact form. - $this->drupalGet('user/' . $this->admin_user->id() . '/contact'); + $this->drupalGet('user/' . $this->adminUser->id() . '/contact'); $this->assertResponse(200); // Revoke the personal contact permission for the anonymous user. user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access user contact forms')); - $this->drupalGet('user/' . $this->contact_user->id() . '/contact'); + $this->drupalGet('user/' . $this->contactUser->id() . '/contact'); $this->assertResponse(403); - $this->drupalGet('user/' . $this->admin_user->id() . '/contact'); + $this->drupalGet('user/' . $this->adminUser->id() . '/contact'); $this->assertResponse(403); // Disable the personal contact form. - $this->drupalLogin($this->admin_user); + $this->drupalLogin($this->adminUser); $edit = array('contact_default_status' => FALSE); $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration')); $this->assertText(t('The configuration options have been saved.'), 'Setting successfully saved.'); @@ -156,78 +167,79 @@ function testPersonalContactAccess() { // Re-create our contacted user with personal contact forms disabled by // default. - $this->contact_user = $this->drupalCreateUser(); + $this->contactUser = $this->drupalCreateUser(); // Test denied access to a user with contact form disabled. - $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(403); // Test allowed access for admin user to a user with contact form disabled. - $this->drupalLogin($this->admin_user); - $this->drupalGet('user/' . $this->contact_user->id() . '/contact'); + $this->drupalLogin($this->adminUser); + $this->drupalGet('user/' . $this->contactUser->id() . '/contact'); $this->assertResponse(200); // Re-create our contacted user as a blocked user. - $this->contact_user = $this->drupalCreateUser(); - $this->contact_user->block(); - $this->contact_user->save(); + $this->contactUser = $this->drupalCreateUser(); + $this->contactUser->block(); + $this->contactUser->save(); // Test that blocked users can still be contacted by admin. - $this->drupalGet('user/' . $this->contact_user->id() . '/contact'); + $this->drupalGet('user/' . $this->contactUser->id() . '/contact'); $this->assertResponse(200); // Test that blocked users cannot be contacted by non-admins. - $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(403); // Test enabling and disabling the contact page through the user profile // form. - $this->drupalGet('user/' . $this->web_user->id() . '/edit'); + $this->drupalGet('user/' . $this->webUser->id() . '/edit'); $this->assertNoFieldChecked('edit-contact--2'); - $this->assertFalse(\Drupal::service('user.data')->get('contact', $this->web_user->id(), 'enabled'), 'Personal contact form disabled'); + $this->assertFalse(\Drupal::service('user.data')->get('contact', $this->webUser->id(), 'enabled'), 'Personal contact form disabled'); $this->drupalPostForm(NULL, array('contact' => TRUE), t('Save')); $this->assertFieldChecked('edit-contact--2'); - $this->assertTrue(\Drupal::service('user.data')->get('contact', $this->web_user->id(), 'enabled'), 'Personal contact form enabled'); + $this->assertTrue(\Drupal::service('user.data')->get('contact', $this->webUser->id(), 'enabled'), 'Personal contact form enabled'); } /** * Tests the personal contact form flood protection. */ - function testPersonalContactFlood() { + public function testPersonalContactFlood() { $flood_limit = 3; \Drupal::config('contact.settings')->set('flood.limit', $flood_limit)->save(); - // Clear flood table in preparation for flood test and allow other checks to complete. + // Clear flood table in preparation for flood test and + // allow other checks to complete. db_delete('flood')->execute(); $num_records_flood = db_query("SELECT COUNT(*) FROM {flood}")->fetchField(); $this->assertIdentical($num_records_flood, '0', 'Flood table emptied.'); - $this->drupalLogin($this->web_user); + $this->drupalLogin($this->webUser); // Submit contact form with correct values and check flood interval. for ($i = 0; $i < $flood_limit; $i++) { - $this->submitPersonalContact($this->contact_user); + $this->submitPersonalContact($this->contactUser); $this->assertText(t('Your message has been sent.'), 'Message sent.'); } // Submit contact form one over limit. - $this->drupalGet('user/' . $this->contact_user->id(). '/contact'); + $this->drupalGet('user/' . $this->contactUser->id() . '/contact'); $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => $flood_limit, '@interval' => format_interval(\Drupal::config('contact.settings')->get('flood.interval')))), 'Normal user denied access to flooded contact form.'); // Test that the admin user can still access the contact form even though // the flood limit was reached. - $this->drupalLogin($this->admin_user); + $this->drupalLogin($this->adminUser); $this->assertNoText('Try again later.', 'Admin user not denied access to flooded contact form.'); } /** * Fills out a user's personal contact form and submits it. * - * @param $account + * @param object $account * A user object of the user being contacted. - * @param $message + * @param array $message * (optional) An array with the form fields being used. Defaults to an empty * array. */ diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php index 7442166..9a40242 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php @@ -22,6 +22,9 @@ class ContactSitewideTest extends WebTestBase { */ public static $modules = array('text', 'contact', 'field_ui'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Site-wide contact form', @@ -33,7 +36,7 @@ class ContactSitewideTest extends WebTestBase { /** * Tests configuration options and the site-wide contact form. */ - function testSiteWideContact() { + public function testSiteWideContact() { // Create and login administrative user. $admin_user = $this->drupalCreateUser(array( 'access site-wide contact form', @@ -62,9 +65,9 @@ function testSiteWideContact() { // User category could not be changed or deleted. // Cannot use ::assertNoLinkByHref as it does partial url matching and with // field_ui enabled admin/structure/contact/manage/personal/fields exists. - // @todo: See https://drupal.org/node/2031223 for the above + // @todo: See https://drupal.org/node/2031223 for the above. $edit_link = $this->xpath('//a[@href=:href]', array( - ':href' => url('admin/structure/contact/manage/personal') + ':href' => url('admin/structure/contact/manage/personal'), )); $this->assertTrue(empty($edit_link), format_string('No link containing href %href found.', array('%href' => 'admin/structure/contact/manage/personal') @@ -96,7 +99,13 @@ function testSiteWideContact() { // Add categories. // Test invalid recipients. - $invalid_recipients = array('invalid', 'invalid@', 'invalid@site.', '@site.', '@site.com'); + $invalid_recipients = array( + 'invalid', + 'invalid@', + 'invalid@site.', + '@site.', + '@site.com', + ); foreach ($invalid_recipients as $invalid_recipient) { $this->addCategory($this->randomName(16), $this->randomName(16), $invalid_recipient, '', FALSE); $this->assertRaw(t('%recipient is an invalid e-mail address.', array('%recipient' => $invalid_recipient))); @@ -109,7 +118,11 @@ function testSiteWideContact() { $this->assertText(t('Recipients field is required.')); // Create first valid category. - $recipients = array('simpletest@example.com', 'simpletest2@example.com', 'simpletest3@example.com'); + $recipients = array( + 'simpletest@example.com', + 'simpletest2@example.com', + 'simpletest3@example.com', + ); $this->addCategory($id = drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array($recipients[0])), '', TRUE); $this->assertRaw(t('Category %label has been added.', array('%label' => $label))); @@ -118,7 +131,8 @@ function testSiteWideContact() { $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. @@ -148,7 +162,8 @@ function testSiteWideContact() { $this->addCategory(drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE); $this->assertRaw(t('Category %label has been added.', array('%label' => $label))); - $this->addCategory($name = drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE); + $this->addCategory($name = drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array( + $recipients[0], $recipients[1], $recipients[2])), '', FALSE); $this->assertRaw(t('Category %label has been added.', array('%label' => $label))); // Try adding a category that already exists. @@ -156,13 +171,15 @@ function testSiteWideContact() { $this->assertNoRaw(t('Category %label has been saved.', array('%label' => $label))); $this->assertRaw(t('The machine-readable name is already in use. It must be unique.')); - // Clear flood table in preparation for flood test and allow other checks to complete. + // Clear flood table in preparation for flood test and + // allow other checks to complete. db_delete('flood')->execute(); $num_records_after = db_query("SELECT COUNT(*) FROM {flood}")->fetchField(); $this->assertIdentical($num_records_after, '0', 'Flood table emptied.'); $this->drupalLogout(); - // Check to see that anonymous user cannot see contact page without permission. + // Check to see that anonymous user cannot see + // contact page without permission. user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form')); $this->drupalGet('contact'); $this->assertResponse(403); @@ -217,7 +234,11 @@ function testSiteWideContact() { $this->deleteCategories(); $label = $this->randomName(16); - $recipients = implode(',', array($recipients[0], $recipients[1], $recipients[2])); + $recipients = implode(',', array( + $recipients[0], + $recipients[1], + $recipients[2], + )); $category = drupal_strtolower($this->randomName(16)); $this->addCategory($category, $label, $recipients, '', FALSE); $this->drupalGet('admin/structure/contact'); @@ -230,8 +251,8 @@ function testSiteWideContact() { // Find out in which row the category we want to add a field to is. $i = 0; - foreach($this->xpath('//table/tbody/tr') as $row) { - if (((string)$row->td[0]) == $label) { + foreach ($this->xpath('//table/tbody/tr') as $row) { + if (((string) $row->td[0]) == $label) { break; } $i++; @@ -270,11 +291,16 @@ function testSiteWideContact() { } /** - * Tests auto-reply on the site-wide contact form. - */ - function testAutoReply() { + * Tests auto-reply on the site-wide contact form. + */ + public function testAutoReply() { // Create and login administrative user. - $admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer contact forms', 'administer permissions', 'administer users')); + $admin_user = $this->drupalCreateUser(array( + 'access site-wide contact form', + 'administer contact forms', + 'administer permissions', + 'administer users', + )); $this->drupalLogin($admin_user); // Set up three categories, 2 with an auto-reply and one without. @@ -293,7 +319,8 @@ function testAutoReply() { $subject = $this->randomName(64); $this->submitContact($this->randomName(16), $email, $subject, 'foo', $this->randomString(128)); - // We are testing the auto-reply, so there should be one e-mail going to the sender. + // We are testing the auto-reply, so there should be + // one e-mail going to the sender. $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email)); $this->assertEqual(count($captured_emails), 1); $this->assertEqual(trim($captured_emails[0]['body']), trim(drupal_html_to_text($foo_autoreply))); @@ -302,12 +329,14 @@ function testAutoReply() { $email = $this->randomName(32) . '@example.com'; $this->submitContact($this->randomName(16), $email, $this->randomString(64), 'bar', $this->randomString(128)); - // Auto-reply for category 'bar' should result in one auto-reply e-mail to the sender. + // Auto-reply for category 'bar' should result in + // one auto-reply e-mail to the sender. $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email)); $this->assertEqual(count($captured_emails), 1); $this->assertEqual(trim($captured_emails[0]['body']), trim(drupal_html_to_text($bar_autoreply))); - // Verify that no auto-reply is sent when the auto-reply field is left blank. + // Verify that no auto-reply is sent when + // the auto-reply field is left blank. $email = $this->randomName(32) . '@example.com'; $this->submitContact($this->randomName(16), $email, $this->randomString(64), 'no_autoreply', $this->randomString(128)); $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email)); @@ -326,10 +355,10 @@ function testAutoReply() { * @param string $reply * The auto-reply text that is sent to a user upon completing the contact * form. - * @param boolean $selected + * @param bool $selected * A Boolean indicating whether the category should be selected by default. */ - function addCategory($id, $label, $recipients, $reply, $selected) { + public function addCategory($id, $label, $recipients, $reply, $selected) { $edit = array(); $edit['label'] = $label; $edit['id'] = $id; @@ -351,10 +380,10 @@ function addCategory($id, $label, $recipients, $reply, $selected) { * @param string $reply * The auto-reply text that is sent to a user upon completing the contact * form. - * @param boolean $selected + * @param bool $selected * A Boolean indicating whether the category should be selected by default. */ - function updateCategory($id, $label, $recipients, $reply, $selected) { + public function updateCategory($id, $label, $recipients, $reply, $selected) { $edit = array(); $edit['label'] = $label; $edit['recipients'] = $recipients; @@ -377,7 +406,7 @@ function updateCategory($id, $label, $recipients, $reply, $selected) { * @param string $message * The message body. */ - function submitContact($name, $mail, $subject, $id, $message) { + public function submitContact($name, $mail, $subject, $id, $message) { $edit = array(); $edit['name'] = $name; $edit['mail'] = $mail; @@ -394,7 +423,7 @@ function submitContact($name, $mail, $subject, $id, $message) { /** * Deletes all categories. */ - function deleteCategories() { + public function deleteCategories() { $categories = entity_load_multiple('contact_category'); foreach ($categories as $id => $category) { if ($id == 'personal') { diff --git a/core/modules/contact/lib/Drupal/contact/Tests/MessageEntityTest.php b/core/modules/contact/lib/Drupal/contact/Tests/MessageEntityTest.php index 489c5de..7c36b13 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/MessageEntityTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/MessageEntityTest.php @@ -23,14 +23,20 @@ class MessageEntityTest extends DrupalUnitTestBase { */ public static $modules = array('system', 'contact', 'field', 'user'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Message entity tests', 'description' => 'Tests the message entity class.', - 'group' => 'Contact' + 'group' => 'Contact', ); } + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); $this->installConfig(array('contact')); diff --git a/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php b/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php index 28216aa..1323076 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php @@ -29,6 +29,9 @@ class ContactFieldsTest extends ViewTestBase { */ protected $field; + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Contact: Field views data', @@ -37,13 +40,16 @@ class ContactFieldsTest extends ViewTestBase { ); } + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); $this->field = entity_create('field_config', array( 'name' => strtolower($this->randomName()), 'entity_type' => 'contact_message', - 'type' => 'text' + 'type' => 'text', )); $this->field->save(); diff --git a/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactLinkTest.php b/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactLinkTest.php index 1bae3d4..316fa37 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactLinkTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactLinkTest.php @@ -38,6 +38,9 @@ class ContactLinkTest extends ViewTestBase { */ public static $testViews = array('test_contact_link'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Contact: Link Field', diff --git a/core/modules/contact/tests/drupal-7.contact.database.php b/core/modules/contact/tests/drupal-7.contact.database.php index ed8e5ba..f823ed3 100644 --- a/core/modules/contact/tests/drupal-7.contact.database.php +++ b/core/modules/contact/tests/drupal-7.contact.database.php @@ -21,11 +21,11 @@ 'recipients', 'reply', 'weight', - 'selected' + 'selected', )) ->values(array( 'category' => 'Upgrade test', - 'recipients'=> 'test1@example.com,test2@example.com', + 'recipients' => 'test1@example.com,test2@example.com', 'reply' => 'Test reply', 'weight' => 1, 'selected' => 1,