Mercurial > hg > isophonics-drupal-site
annotate core/modules/views/tests/src/Functional/TaxonomyGlossaryTest.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\Tests\views\Functional; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait; |
Chris@0 | 6 |
Chris@0 | 7 /** |
Chris@0 | 8 * Tests glossary functionality of taxonomy views. |
Chris@0 | 9 * |
Chris@0 | 10 * @group views |
Chris@0 | 11 */ |
Chris@0 | 12 class TaxonomyGlossaryTest extends ViewTestBase { |
Chris@0 | 13 |
Chris@0 | 14 use TaxonomyTestTrait; |
Chris@0 | 15 |
Chris@0 | 16 /** |
Chris@0 | 17 * Modules to enable. |
Chris@0 | 18 * |
Chris@0 | 19 * @var array |
Chris@0 | 20 */ |
Chris@0 | 21 public static $modules = ['taxonomy']; |
Chris@0 | 22 |
Chris@0 | 23 /** |
Chris@0 | 24 * Views used by this test. |
Chris@0 | 25 * |
Chris@0 | 26 * @var array |
Chris@0 | 27 */ |
Chris@0 | 28 public static $testViews = ['test_taxonomy_glossary']; |
Chris@0 | 29 |
Chris@0 | 30 /** |
Chris@0 | 31 * Taxonomy terms used by this test. |
Chris@0 | 32 * |
Chris@0 | 33 * @var \Drupal\taxonomy\Entity\Term[] |
Chris@0 | 34 */ |
Chris@0 | 35 protected $taxonomyTerms; |
Chris@0 | 36 |
Chris@0 | 37 protected function setUp($import_test_views = TRUE) { |
Chris@0 | 38 parent::setUp($import_test_views); |
Chris@0 | 39 |
Chris@0 | 40 $this->enableViewsTestModule(); |
Chris@0 | 41 |
Chris@0 | 42 /** @var \Drupal\taxonomy\Entity\Vocabulary $vocabulary */ |
Chris@0 | 43 $vocabulary = $this->createVocabulary(); |
Chris@0 | 44 for ($i = 0; $i < 10; $i++) { |
Chris@0 | 45 $this->taxonomyTerms[] = $this->createTerm($vocabulary); |
Chris@0 | 46 } |
Chris@0 | 47 } |
Chris@0 | 48 |
Chris@0 | 49 /** |
Chris@0 | 50 * Tests a taxonomy glossary view. |
Chris@0 | 51 */ |
Chris@0 | 52 public function testTaxonomyGlossaryView() { |
Chris@0 | 53 // Go the taxonomy glossary page for the first term. |
Chris@0 | 54 $this->drupalGet('test_taxonomy_glossary/' . substr($this->taxonomyTerms[0]->getName(), 0, 1)); |
Chris@0 | 55 $this->assertText($this->taxonomyTerms[0]->getName()); |
Chris@0 | 56 } |
Chris@0 | 57 |
Chris@0 | 58 } |