You are here

protected function SimplesitemapTestBase::assertNoUniqueTextWorkaround in Simple XML sitemap 8.3

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/SimplesitemapTestBase.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTestBase::assertNoUniqueTextWorkaround()
  2. 4.x tests/src/Functional/SimplesitemapTestBase.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTestBase::assertNoUniqueTextWorkaround()

Helper function to replace assertNoUniqueText.

Also adapt the legacy trait method because it can't be applied to Non-HTML pages.

@See \Drupal\FunctionalTests\AssertLegacyTrait::assertNoUniqueText().

Parameters

string $text: The text to look for.

1 call to SimplesitemapTestBase::assertNoUniqueTextWorkaround()
SimplesitemapTest::testRemoveDuplicatesSetting in tests/src/Functional/SimplesitemapTest.php
Tests the duplicate setting.

File

tests/src/Functional/SimplesitemapTestBase.php, line 124

Class

SimplesitemapTestBase
Provides the base class for web tests for Simple sitemap.

Namespace

Drupal\Tests\simple_sitemap\Functional

Code

protected function assertNoUniqueTextWorkaround($text) {
  $page_text = $this
    ->getSession()
    ->getPage()
    ->getContent();
  $nr_found = substr_count($page_text, $text);
  $this
    ->assertGreaterThan(1, $nr_found);
}