Unverified Commit 6108526c authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3113077 by mondrake, Hardik_Patel_12, Neslee Canil Pinto,...

Issue #3113077 by mondrake, Hardik_Patel_12, Neslee Canil Pinto, swatichouhan012, prabha1997, neelam_wadhwani, Berdir, longwave: Replace assertContains() on strings with assertStringContainsString() or assertStringContainsStringIgnoringCase()
parent 396a950c
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -65,25 +65,25 @@ public function testStringFormatter() {
    $build = $aggregator_feed->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => TRUE]]);
    $result = $this->render($build);

    $this->assertContains('testing title', $result);
    $this->assertContains('href="' . $aggregator_feed->getUrl() . '"', $result);
    $this->assertStringContainsString('testing title', $result);
    $this->assertStringContainsString('href="' . $aggregator_feed->getUrl() . '"', $result);

    $build = $aggregator_feed->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => FALSE]]);
    $result = $this->render($build);
    $this->assertContains('testing title', $result);
    $this->assertNotContains($aggregator_feed->getUrl(), $result);
    $this->assertStringContainsString('testing title', $result);
    $this->assertStringNotContainsString($aggregator_feed->getUrl(), $result);

    // Verify aggregator item title with and without links.
    $build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => TRUE]]);
    $result = $this->render($build);

    $this->assertContains('test title', $result);
    $this->assertContains('href="' . $aggregator_item->getLink() . '"', $result);
    $this->assertStringContainsString('test title', $result);
    $this->assertStringContainsString('href="' . $aggregator_item->getLink() . '"', $result);

    $build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => FALSE]]);
    $result = $this->render($build);
    $this->assertContains('test title', $result);
    $this->assertNotContains($aggregator_item->getLink(), $result);
    $this->assertStringContainsString('test title', $result);
    $this->assertStringNotContainsString($aggregator_item->getLink(), $result);
  }

}
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ public function testCommentPopulatedTitles() {
    $comment_permalink = $this->cssSelect('.permalink');
    $comment_permalink = $comment_permalink[0]->getAttribute('href');
    // Tests that the comment's title link contains the url fragment.
    $this->assertContains('#comment-' . $comment1->id(), $comment_permalink, "The comment's title link contains the url fragment.");
    $this->assertStringContainsString('#comment-' . $comment1->id(), $comment_permalink, "The comment's title link contains the url fragment.");
    $this->assertEqual($comment1->permalink()->toString(), $comment_permalink, "The comment's title has the correct link.");
  }

+2 −2
Original line number Diff line number Diff line
@@ -86,8 +86,8 @@ protected function copyTestingOverrides() {
   */
  public function testInstalled() {
    if ($this->expectedException) {
      $this->assertContains('Configuration objects provided by <em class="placeholder">testing_config_overrides</em> have unmet dependencies: <em class="placeholder">system.action.user_block_user_action (does_not_exist)</em>', $this->expectedException->getMessage());
      $this->assertContains('Drupal\Core\Config\UnmetDependenciesException', $this->expectedException->getMessage());
      $this->assertStringContainsString('Configuration objects provided by <em class="placeholder">testing_config_overrides</em> have unmet dependencies: <em class="placeholder">system.action.user_block_user_action (does_not_exist)</em>', $this->expectedException->getMessage());
      $this->assertStringContainsString('Drupal\Core\Config\UnmetDependenciesException', $this->expectedException->getMessage());
    }
    else {
      $this->fail('Expected Drupal\Core\Config\UnmetDependenciesException exception not thrown');
+2 −2
Original line number Diff line number Diff line
@@ -329,8 +329,8 @@ public function testSiteWideContact() {
    $mails = $this->getMails();
    $mail = array_pop($mails);
    $this->assertEqual($mail['subject'], t('[@label] @subject', ['@label' => $label, '@subject' => $edit['subject[0][value]']]));
    $this->assertContains($field_label, $mail['body']);
    $this->assertContains($edit[$field_name . '[0][value]'], $mail['body']);
    $this->assertStringContainsString($field_label, $mail['body']);
    $this->assertStringContainsString($edit[$field_name . '[0][value]'], $mail['body']);

    // Test messages and redirect.
    /** @var \Drupal\contact\ContactFormInterface $form */
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public function testContentTranslationContextualLinks() {
    $this->drupalLogin($this->translator);
    $this->drupalGet('node/' . $node->id());
    $link = $this->assertSession()->waitForElement('css', '[data-contextual-id^="node:node=1"] .contextual-links a:contains("Translate")');
    $this->assertContains('node/1/translations', $link->getAttribute('href'));
    $this->assertStringContainsString('node/1/translations', $link->getAttribute('href'));
  }

}
Loading