diff --git a/core/modules/contact/lib/Drupal/contact/Controller/ContactPageController.php b/core/modules/contact/lib/Drupal/contact/Controller/ContactPageController.php index 41a045d..4825194 100644 --- a/core/modules/contact/lib/Drupal/contact/Controller/ContactPageController.php +++ b/core/modules/contact/lib/Drupal/contact/Controller/ContactPageController.php @@ -95,8 +95,8 @@ public static function create(ContainerInterface $container) { * The form as render array as expected by drupal_render(). * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - * Exception is thrown when user tries to access non existing contact - * category form. + * Exception is thrown when user tries to access non existing default + * contact category form. */ public function contactSitePage(AccountInterface $_account, Category $contact_category = NULL) { // Check if flood control has been activated for sending e-mails. diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php index 924dbb2..264f812 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php @@ -90,6 +90,9 @@ function testSiteWideContact() { $this->drupalGet('contact'); $this->assertResponse(200); $this->assertText(t('The contact form has not been configured.')); + // Test access personal category via site-wide contact page. + $this->drupalGet('contact/personal'); + $this->assertResponse(403); // Add categories. // Test invalid recipients. @@ -187,20 +190,6 @@ function testSiteWideContact() { $this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $id, ''); $this->assertText(t('Message field is required.')); - // Submit contact form with correct values and check flood interval. - for ($i = 0; $i < $flood_limit; $i++) { - $this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $id, $this->randomName(64)); - $this->assertText(t('Your message has been sent.')); - } - // Submit contact form one over limit. - $this->drupalGet('contact'); - $this->assertResponse(403); - $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array( - '%number' => $this->container->get('config.factory')->get('contact.settings')->get('flood.limit'), - '@interval' => format_interval(600)) - )); - - $this->container->get('flood')->clear('contact'); // Test contact form with no default category selected. $this->container->get('config.factory') ->get('contact.settings') @@ -215,21 +204,23 @@ function testSiteWideContact() { $this->drupalGet('contact/' . $this->randomName()); $this->assertResponse(404); + // Submit contact form with correct values and check flood interval. + for ($i = 0; $i < $flood_limit; $i++) { + $this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $id, $this->randomName(64)); + $this->assertText(t('Your message has been sent.')); + } + // Submit contact form one over limit. + $this->drupalGet('contact'); + $this->assertResponse(403); + $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array( + '%number' => $this->container->get('config.factory')->get('contact.settings')->get('flood.limit'), + '@interval' => format_interval(600)) + )); + // Test listing controller. $this->drupalLogin($admin_user); $this->deleteCategories(); - // Test contact form with unknown category selected for admin. - $this->container->get('config.factory') - ->get('contact.settings') - ->set('default_category', drupal_strtolower($this->randomName(16))) - ->save(); - $this->drupalGet('contact'); - $this->assertResponse(200); - $this->assertRaw( - t('The contact form has not been configured. Add one or more categories to the form.', array('@add' => url('admin/structure/contact/add'))), - 'Admin error found' - ); $label = $this->randomName(16); $recipients = implode(',', array($recipients[0], $recipients[1], $recipients[2]));