Commit 687d72da authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2321701 by Temoor, rpayanm: Replace all instances of...

Issue #2321701 by Temoor, rpayanm: Replace all instances of contact_form_load(), entity_load('contact_form') and entity_load_multiple('contact_form') with static method calls.
parent 77f75777
Loading
Loading
Loading
Loading
+3 −2
Changes for core/modules/contact/src/Tests/ContactSitewideTest.php: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
namespace Drupal\contact\Tests;

use Drupal\Component\Utility\Unicode;
use Drupal\contact\Entity\ContactForm;
use Drupal\Core\Mail\MailFormatHelper;
use Drupal\simpletest\WebTestBase;
use Drupal\Core\Entity\EntityTypeInterface;
@@ -402,7 +403,7 @@ function submitContact($name, $mail, $subject, $id, $message) {
   * Deletes all forms.
   */
  function deleteContactForms() {
    $contact_forms = entity_load_multiple('contact_form');
    $contact_forms = ContactForm::loadMultiple();;
    foreach ($contact_forms as $id => $contact_form) {
      if ($id == 'personal') {
        // Personal form could not be deleted.
@@ -412,7 +413,7 @@ function deleteContactForms() {
      else {
        $this->drupalPostForm("admin/structure/contact/manage/$id/delete", array(), t('Delete'));
        $this->assertRaw(t('Contact form %label has been deleted.', array('%label' => $contact_form->label())));
        $this->assertFalse(entity_load('contact_form', $id), format_string('Form %contact_form not found', array('%contact_form' => $contact_form->label())));
        $this->assertFalse(ContactForm::load($id), format_string('Form %contact_form not found', array('%contact_form' => $contact_form->label())));
      }
    }
  }
+4 −3
Changes for core/modules/migrate_drupal/src/Tests/d6/MigrateContactCategoryTest.php: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@

namespace Drupal\migrate_drupal\Tests\d6;

use Drupal\contact\Entity\ContactForm;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate\MigrateMessage;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
@@ -44,19 +45,19 @@ protected function setUp() {
   */
  public function testContactCategory() {
    /** @var \Drupal\contact\Entity\ContactForm $contact_form */
    $contact_form = entity_load('contact_form', 'website_feedback');
    $contact_form = ContactForm::load('website_feedback');
    $this->assertEqual($contact_form->label(), 'Website feedback');
    $this->assertEqual($contact_form->getRecipients(), array('admin@example.com'));
    $this->assertEqual($contact_form->getReply(), '');
    $this->assertEqual($contact_form->getWeight(), 0);

    $contact_form = entity_load('contact_form', 'some_other_category');
    $contact_form = ContactForm::load('some_other_category');
    $this->assertEqual($contact_form->label(), 'Some other category');
    $this->assertEqual($contact_form->getRecipients(), array('test@example.com'));
    $this->assertEqual($contact_form->getReply(), 'Thanks for contacting us, we will reply ASAP!');
    $this->assertEqual($contact_form->getWeight(), 1);

    $contact_form = entity_load('contact_form', 'a_category_much_longer_than_thir');
    $contact_form = ContactForm::load('a_category_much_longer_than_thir');
    $this->assertEqual($contact_form->label(), 'A category much longer than thirty two characters');
    $this->assertEqual($contact_form->getRecipients(), array('fortyninechars@example.com'));
    $this->assertEqual($contact_form->getReply(), '');