function GenerateCommandsKernelTest::testContent

A small number of nodes is generated without a batch.

File

devel_generate/tests/src/Kernel/GenerateCommandsKernelTest.php, line 126

Class

GenerateCommandsKernelTest
Tests the devel_generate commands.

Namespace

Drupal\Tests\devel_generate\Kernel

Code

public function testContent() : void {
  // Nodes need an author.
  User::create([
    'name' => 'author',
  ])->save();
  $display = $this->runCommand(GenerateContentCommand::class, [
    'num' => '5',
    '--bundles' => 'page',
  ])
    ->getDisplay();
  $this->assertSame(5, $this->countEntities('node'));
  $this->assertStringContainsString('Created 5 nodes', $display);
  $this->assertStringNotContainsString('Finished', $display);
}