Commit 4f8ff590 authored by Sascha Grossenbacher's avatar Sascha Grossenbacher Committed by Sascha Grossenbacher
Browse files

Issue #3286716 by Lal_, Project Update Bot, Berdir: Automated Drupal 10 compatibility fixes

parent 4aa06acc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
    "description": "Provides storage and edit capability for contact messages.",
    "type": "drupal-module",
    "require": {
        "drupal/core": "^8.7.7 || ^9",
        "drupal/core": "^9.1 || ^10",
        "drupal/token": "^1.6"
    }
}
+1 −1
Original line number Diff line number Diff line
name: 'Contact storage'
type: module
description: 'Provides storage and edit capability for contact messages.'
core_version_requirement: '^8.8 || ^9'
core_version_requirement: ^9.1 || ^10
dependencies:
  - drupal:contact
  - drupal:views
+2 −0
Original line number Diff line number Diff line
@@ -512,6 +512,7 @@ function contact_storage_maximum_submissions_user(ContactFormInterface $contact_
    // Anonymous user, limit per submission with the same IP address.
    $ip_address = \Drupal::request()->getClientIp();
    $query = \Drupal::entityQuery('contact_message')
      ->accessCheck()
      ->condition('contact_form', $contact_form->id())
      ->condition('ip_address', $ip_address)
      ->condition('uid', $account->id());
@@ -520,6 +521,7 @@ function contact_storage_maximum_submissions_user(ContactFormInterface $contact_
  else {
    // Limit per submission with the same uid.
    $query = \Drupal::entityQuery('contact_message')
      ->accessCheck()
      ->condition('contact_form', $contact_form->id())
      ->condition('uid', $account->id());
    return count($query->execute());
+0 −1
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ name: 'Contact test views'
type: module
description: 'Provides default views for views contact tests.'
package: Testing
core_version_requirement: '^8.8 || ^9'
dependencies:
  - contact_storage:contact_storage
  - drupal:language
+9 −8
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ class BulkFormTest extends ContactStorageTestBase {
   *
   * @var array
   */
  public static $modules = [
  protected static $modules = [
    'contact_storage',
    'contact_test_views',
    'language',
@@ -39,7 +39,7 @@ class BulkFormTest extends ContactStorageTestBase {
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
  protected function setUp(): void {
    parent::Setup();
    // Create and login administrative user.
    $admin_user = $this->drupalCreateUser([
@@ -49,17 +49,17 @@ class BulkFormTest extends ContactStorageTestBase {
    // Create first valid contact form.
    $mail = 'simpletest@example.com';
    $this->addContactForm('test_id', 'test_label', $mail, TRUE);
    $this->assertText('Contact form test_label has been added.');
    $this->assertSession()->pageTextContains('Contact form test_label has been added.');
    $this->drupalLogout();

    // Ensure that anonymous can submit site-wide contact form.
    user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, ['access site-wide contact form']);
    $this->drupalGet('contact');
    $this->assertText('Your email address');
    $this->assertSession()->pageTextContains('Your email address');
    // Submit contact form few times.
    for ($i = 1; $i <= 5; $i++) {
      $this->submitContact($this->randomMachineName(), $mail, $this->randomMachineName(), 'test_id', $this->randomMachineName());
      $this->assertText('Your message has been sent.');
      $this->assertSession()->pageTextContains('Your message has been sent.');
    }
  }

@@ -73,9 +73,10 @@ class BulkFormTest extends ContactStorageTestBase {
    $this->drupalLogin($this->drupalCreateUser(['administer contact forms']));
    $this->drupalGet('test-contact-message-bulk-form');
    $elements = $this->xpath('//select[@id="edit-action"]//option');
    $this->assertIdentical(count($elements), 1, 'All contact message operations are found.');
    $this->drupalPostForm('test-contact-message-bulk-form', [], t('Apply to selected items'));
    $this->assertText('No message selected.');
    $this->assertSame(count($elements), 1, 'All contact message operations are found.');
    $this->drupalGet('test-contact-message-bulk-form');
    $this->submitForm([], t('Apply to selected items'));
    $this->assertSession()->pageTextContains('No message selected.');
  }

}
Loading