function DevelGenerateCommandsTest::testDrushGenerateTerms

Tests generating terms.

File

devel_generate/tests/src/Functional/DevelGenerateCommandsTest.php, line 80

Class

DevelGenerateCommandsTest
Test class for the Devel Generate drush commands.

Namespace

Drupal\Tests\devel_generate\Functional

Code

public function testDrushGenerateTerms() : void {
  // Make sure terms get created, and with correct vocab.
  $this->drush(DevelGenerateCommands::TERMS, [
    '55',
  ], [
    'kill' => NULL,
    'bundles' => $this->vocabulary
      ->id(),
  ]);
  $term = Term::load(55);
  $this->assertEquals($this->vocabulary
    ->id(), $term->bundle());
  // Make sure terms get created, with proper language.
  $this->drush(DevelGenerateCommands::TERMS, [
    '10',
  ], [
    'kill' => NULL,
    'bundles' => $this->vocabulary
      ->id(),
    'languages' => 'fr',
  ]);
  $term = Term::load(60);
  $this->assertEquals('fr', $term->language()
    ->getId());
  // Make sure terms gets created, with proper translation.
  $this->drush(DevelGenerateCommands::TERMS, [
    '10',
  ], [
    'kill' => NULL,
    'bundles' => $this->vocabulary
      ->id(),
    'languages' => 'fr',
    'translations' => 'de',
  ]);
  $term = Term::load(70);
  $this->assertTrue($term->hasTranslation('de'));
  $this->assertTrue($term->hasTranslation('fr'));
}