function ToolkitGdTest::setUp

Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php \Drupal\KernelTests\Core\Image\ToolkitGdTest::setUp()
  2. 10 core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php \Drupal\KernelTests\Core\Image\ToolkitGdTest::setUp()
  3. 11.x core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php \Drupal\KernelTests\Core\Image\ToolkitGdTest::setUp()

Overrides KernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php, line 53

Class

ToolkitGdTest
Tests for the GD image toolkit.

Namespace

Drupal\KernelTests\Core\Image

Code

protected function setUp() : void {
    parent::setUp();
    $this->installConfig([
        'system',
    ]);
    // Set the image factory service.
    $this->imageFactory = $this->container
        ->get('image.factory');
    $this->assertEquals('gd', $this->imageFactory
        ->getToolkitId(), 'The image factory is set to use the \'gd\' image toolkit.');
    // Prepare a directory for test file results.
    $this->directory = 'public://imagetest';
    \Drupal::service('file_system')->prepareDirectory($this->directory, FileSystemInterface::CREATE_DIRECTORY);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.