TaxonomyGlossaryTest.php in Drupal 10
File
core/modules/views/tests/src/Functional/TaxonomyGlossaryTest.php
View source
<?php
namespace Drupal\Tests\views\Functional;
use Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait;
class TaxonomyGlossaryTest extends ViewTestBase {
use TaxonomyTestTrait;
protected static $modules = [
'taxonomy',
];
protected $defaultTheme = 'stark';
public static $testViews = [
'test_taxonomy_glossary',
];
protected $taxonomyTerms;
protected function setUp($import_test_views = TRUE, $modules = [
'views_test_config',
]) : void {
parent::setUp($import_test_views, $modules);
$this
->enableViewsTestModule();
$vocabulary = $this
->createVocabulary();
for ($i = 0; $i < 10; $i++) {
$this->taxonomyTerms[] = $this
->createTerm($vocabulary);
}
}
public function testTaxonomyGlossaryView() {
$this
->drupalGet('test_taxonomy_glossary/' . substr($this->taxonomyTerms[0]
->getName(), 0, 1));
$this
->assertSession()
->pageTextContains($this->taxonomyTerms[0]
->getName());
}
}