AssertNoUniqueTextRector
Fixes deprecated AssertLegacyTrait::assertNoUniqueText() calls
-$this->assertNoUniqueText('Duplicated message');
+$page_text = $this->getSession()->getPage()->getText();
+$nr_found = substr_count($page_text, 'Duplicated message');
+$this->assertGreaterThan(1, $nr_found, "'Duplicated message' found more than once on the page");
Configure your rector.php:
<?php
use DrupalRector\Drupal9\Rector\Deprecation\AssertNoUniqueTextRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
AssertNoUniqueTextRector::class,
]);