diff --git a/core/modules/taxonomy/src/Tests/Views/ArgumentValidatorTermNameTest.php b/core/modules/taxonomy/src/Tests/Views/ArgumentValidatorTermNameTest.php index 75d6423..1843284 100644 --- a/core/modules/taxonomy/src/Tests/Views/ArgumentValidatorTermNameTest.php +++ b/core/modules/taxonomy/src/Tests/Views/ArgumentValidatorTermNameTest.php @@ -72,7 +72,7 @@ class ArgumentValidatorTermNameTest extends TaxonomyTestBase { protected function setUp() { parent::setUp(); - // Create a second vocabulary for duplicate term. + // Create a second vocabulary for duplicate term and filtering by bundle. $this->vocabulary2 = Vocabulary::create(array( 'name' => 'Other vocabulary tags', 'vid' => 'other_testing_tags', @@ -88,6 +88,15 @@ protected function setUp() { 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ]; $this->createTerm($settings); + + // Add a term to test for terms outside the configured bundle. + $settings = [ + 'name' => 'nonbundle', + 'description' => $this->randomMachineName(), + 'vid' => $this->vocabulary2->id(), + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, + ]; + $this->createTerm($settings); } /** @@ -109,10 +118,23 @@ public function testArgumentValidatorTermName() { $view->argument['name']->validated_title = NULL; $view->argument['name']->argument_validated = NULL; + // Test that multiple valid terms don't validate because multiple arguments + // are currently not supported. + $multiple_terms = $this->term2->getName() . '+' . $this->term1->getName(); + $this->assertFalse($view->argument['name']->setArgument($multiple_terms)); + $view->argument['name']->validated_title = NULL; + $view->argument['name']->argument_validated = NULL; + // Pass in an invalid term. $this->assertFalse($view->argument['name']->setArgument(rand(1000, 10000))); $view->argument['name']->validated_title = NULL; $view->argument['name']->argument_validated = NULL; + + // Test filtering by bundle by passing a term from a vocabulary that is not + // in the bundle settings. + $this->assertFalse($view->argument['name']->setArgument('nonbundle')); + $view->argument['name']->validated_title = NULL; + $view->argument['name']->argument_validated = NULL; } }