function GenerateCommandsKernelTest::testTaxonomy
Tests devel-generate:vocabs and devel-generate:terms.
File
-
devel_generate/
tests/ src/ Kernel/ GenerateCommandsKernelTest.php, line 183
Class
- GenerateCommandsKernelTest
- Tests the devel_generate commands.
Namespace
Drupal\Tests\devel_generate\KernelCode
public function testTaxonomy() : void {
$this->runCommand(GenerateVocabsCommand::class, [
'num' => '3',
]);
$this->assertSame(4, $this->countEntities('taxonomy_vocabulary'));
$this->runCommand(GenerateTermsCommand::class, [
'num' => '12',
'--bundles' => 'tags',
'--max-depth' => '2',
]);
$this->assertSame(12, $this->countEntities('taxonomy_term'));
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Invalid vocabulary machine name: no_such_vocabulary');
$this->runCommand(GenerateTermsCommand::class, [
'--bundles' => 'no_such_vocabulary',
]);
}