class TaxonomyVocabularyArgumentTest
Same name and namespace in other branches
- 11.x core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php \Drupal\Tests\taxonomy\Functional\Views\TaxonomyVocabularyArgumentTest
- 10 core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php \Drupal\Tests\taxonomy\Functional\Views\TaxonomyVocabularyArgumentTest
- 8.9.x core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php \Drupal\Tests\taxonomy\Functional\Views\TaxonomyVocabularyArgumentTest
Tests the vocabulary argument.
@group taxonomy
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\views\Functional\ViewTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\taxonomy\Functional\Views\TaxonomyTestBase uses \Drupal\Tests\field\Traits\EntityReferenceTestTrait extends \Drupal\Tests\views\Functional\ViewTestBase
- class \Drupal\Tests\taxonomy\Functional\Views\TaxonomyVocabularyArgumentTest extends \Drupal\Tests\taxonomy\Functional\Views\TaxonomyTestBase
- class \Drupal\Tests\taxonomy\Functional\Views\TaxonomyTestBase uses \Drupal\Tests\field\Traits\EntityReferenceTestTrait extends \Drupal\Tests\views\Functional\ViewTestBase
- class \Drupal\Tests\views\Functional\ViewTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of TaxonomyVocabularyArgumentTest
File
-
core/
modules/ taxonomy/ tests/ src/ Functional/ Views/ TaxonomyVocabularyArgumentTest.php, line 12
Namespace
Drupal\Tests\taxonomy\Functional\ViewsView source
class TaxonomyVocabularyArgumentTest extends TaxonomyTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'taxonomy',
'taxonomy_test_views',
'views',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
public static $testViews = [
'test_argument_taxonomy_vocabulary',
];
/**
* @var \Drupal\taxonomy\TermInterface[]
*/
protected $terms = [];
/**
* Vocabularies used for creating terms.
*
* @var \Drupal\taxonomy\VocabularyInterface[]
*/
protected $vocabularies;
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE, $modules = []) : void {
parent::setUp($import_test_views, $modules);
// Add default vocabulary to list of vocabularies.
$this->vocabularies[] = $this->vocabulary;
// Create additional vocabulary.
$vocabulary = Vocabulary::create([
'name' => 'Views testing category',
'vid' => 'views_testing_category',
]);
$vocabulary->save();
$this->vocabularies[] = $vocabulary;
// Create some terms.
$this->terms[0] = $this->createTerm([
'name' => 'First',
'vid' => $this->vocabularies[0]
->id(),
]);
$this->terms[1] = $this->createTerm([
'name' => 'Second',
'vid' => $this->vocabularies[1]
->id(),
]);
}
/**
* Tests the vocabulary argument handler.
*
* @see Drupal\taxonomy\Plugin\views\argument\VocabularyVid
*/
public function testTermWithVocabularyArgument() {
$this->drupalGet('test_argument_taxonomy_vocabulary/' . $this->vocabularies[0]
->id());
// First term should be present.
$this->assertSession()
->pageTextContains($this->terms[0]
->label());
// Second term should not be present.
$this->assertSession()
->pageTextNotContains($this->terms[1]
->label());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.