You are here

protected function SimplesitemapTestBase::assertUniqueTextWorkaround in Simple XML sitemap 4.x

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

Helper function to replace assertUniqueText.

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

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

Parameters

string $text: The text to look for.

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

File

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

Class

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

Namespace

Drupal\Tests\simple_sitemap\Functional

Code

protected function assertUniqueTextWorkaround($text) {
  $page_content = $this
    ->getSession()
    ->getPage()
    ->getContent();
  $nr_found = substr_count($page_content, $text);
  $this
    ->assertSame(1, $nr_found);
}