HelpPageOrderTest.php in Drupal 9
File
core/modules/help/tests/src/Functional/HelpPageOrderTest.php
View source
<?php
namespace Drupal\Tests\help\Functional;
use Drupal\Tests\BrowserTestBase;
class HelpPageOrderTest extends BrowserTestBase {
protected static $modules = [
'help',
'tour',
];
protected $defaultTheme = 'stark';
protected $stringOrder = [
'Module overviews are provided',
'Tours guide you',
];
protected function setUp() : void {
parent::setUp();
$account = $this
->drupalCreateUser([
'access administration pages',
'view the administration theme',
'administer permissions',
'access tour',
]);
$this
->drupalLogin($account);
}
public function testHelp() {
$pos = 0;
$this
->drupalGet('admin/help');
$page_text = $this
->getTextContent();
foreach ($this->stringOrder as $item) {
$new_pos = strpos($page_text, $item, $pos);
$this
->assertGreaterThan($pos, $new_pos, "Order of {$item} is not correct on help page");
$pos = $new_pos;
}
}
}