You are here

protected function ImageTest::setUp in Drupal 8

Same name in this branch
  1. 8 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::setUp()
  2. 8 core/tests/Drupal/KernelTests/Core/Theme/ImageTest.php \Drupal\KernelTests\Core\Theme\ImageTest::setUp()
Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Theme/ImageTest.php \Drupal\KernelTests\Core\Theme\ImageTest::setUp()

Overrides KernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Theme/ImageTest.php, line 29

Class

ImageTest
Tests built-in image theme functions.

Namespace

Drupal\KernelTests\Core\Theme

Code

protected function setUp() {
  parent::setUp();

  // The code under test uses file_url_transform_relative(), which relies on
  // the Request containing the correct hostname. KernelTestBase doesn't set
  // it, so push another request onto the stack to ensure it's correct.
  $request = Request::create('/', 'GET', [], [], [], $_SERVER);
  $this->container = \Drupal::service('kernel')
    ->getContainer();
  $this->container
    ->get('request_stack')
    ->push($request);
  $this->testImages = [
    'core/misc/druplicon.png',
    'core/misc/loading.gif',
  ];
}