You are here

public function TextimageTest::testTextimageCronRun in Textimage 8.3

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

Test execution of Textimage cron hook.

File

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

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, file_scan_directory('public://textimage_store/temp', '/.*/'));

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

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