You are here

public function TextimageTest::testTextimageCronRun in Textimage 8.4

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/TextimageTest.php \Drupal\Tests\textimage\Functional\TextimageTest::testTextimageCronRun()

Test execution of Textimage cron hook.

File

tests/src/Functional/TextimageTest.php, line 160

Class

TextimageTest
Basic functionality of the Textimage module.

Namespace

Drupal\Tests\textimage\Functional

Code

public function testTextimageCronRun() {

  // Build a temporary textimage via API.
  $textimage = $this->textimageFactory
    ->get();
  $textimage
    ->setStyle(ImageStyle::load('textimage_test'))
    ->setTemporary(TRUE)
    ->process([
    'text image for cron run',
  ])
    ->buildImage();

  // Temp file should be created at location.
  $this
    ->assertCount(1, $this->fileSystem
    ->scanDirectory('public://textimage_store/temp', '/.*/'));

  // Run cron.
  $this
    ->cronRun();

  // Temp directory should be removed.
  $this
    ->assertDirectoryNotExists('public://textimage_store/temp');
}