Mercurial > hg > isophonics-drupal-site
diff core/modules/views/tests/src/Functional/TaxonomyGlossaryTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/views/tests/src/Functional/TaxonomyGlossaryTest.php Wed Nov 29 16:09:58 2017 +0000 @@ -0,0 +1,58 @@ +<?php + +namespace Drupal\Tests\views\Functional; + +use Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait; + +/** + * Tests glossary functionality of taxonomy views. + * + * @group views + */ +class TaxonomyGlossaryTest extends ViewTestBase { + + use TaxonomyTestTrait; + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['taxonomy']; + + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = ['test_taxonomy_glossary']; + + /** + * Taxonomy terms used by this test. + * + * @var \Drupal\taxonomy\Entity\Term[] + */ + protected $taxonomyTerms; + + protected function setUp($import_test_views = TRUE) { + parent::setUp($import_test_views); + + $this->enableViewsTestModule(); + + /** @var \Drupal\taxonomy\Entity\Vocabulary $vocabulary */ + $vocabulary = $this->createVocabulary(); + for ($i = 0; $i < 10; $i++) { + $this->taxonomyTerms[] = $this->createTerm($vocabulary); + } + } + + /** + * Tests a taxonomy glossary view. + */ + public function testTaxonomyGlossaryView() { + // Go the taxonomy glossary page for the first term. + $this->drupalGet('test_taxonomy_glossary/' . substr($this->taxonomyTerms[0]->getName(), 0, 1)); + $this->assertText($this->taxonomyTerms[0]->getName()); + } + +}