public function TaxonomyUniqueTest::testCrossVocabulary in Taxonomy unique 8.2
Tests whether terms with the same name can be saved in different vocabularies.
File
- tests/
src/ Kernel/ TaxonomyUniqueTest.php, line 71
Class
- TaxonomyUniqueTest
- Tests for taxonomy unique module.
Namespace
Drupal\Tests\taxonomy_unique\KernelCode
public function testCrossVocabulary() {
$vocabulary1 = $this
->createVocabulary();
$vocabulary2 = $this
->createVocabulary();
$GLOBALS['config']['taxonomy_unique.settings'] = [
$vocabulary1
->id() => TRUE,
$vocabulary2
->id() => TRUE,
];
$t1 = $this
->createTerm($vocabulary1, [
'name' => 'Term 1',
]);
$t1_violations = $t1
->validate();
$this
->assertEquals(0, $t1_violations
->count());
$t2 = $this
->createTerm($vocabulary2, [
'name' => 'Term 1',
]);
$t2_violations = $t2
->validate();
$this
->assertEquals(0, $t2_violations
->count());
}