You are here

public function AspectSwitcherTest::setUp in Image Effects 8

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/Effect/AspectSwitcherTest.php \Drupal\Tests\image_effects\Functional\Effect\AspectSwitcherTest::setUp()
  2. 8.2 tests/src/Functional/Effect/AspectSwitcherTest.php \Drupal\Tests\image_effects\Functional\Effect\AspectSwitcherTest::setUp()

Overrides ImageEffectsTestBase::setUp

File

tests/src/Functional/Effect/AspectSwitcherTest.php, line 45

Class

AspectSwitcherTest
AspectSwitcher effect test.

Namespace

Drupal\Tests\image_effects\Functional\Effect

Code

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

  // Create 2 test image styles, one for landscape and one for portrait and
  // add the specific effect to each.
  foreach ([
    'landscape',
    'portrait',
  ] as $orientation) {
    $style_name = $orientation . '_image_style_test';
    $style_label = ucfirst($orientation) . ' Image Style Test';
    $style = ImageStyle::create([
      'name' => $style_name,
      'label' => $style_label,
    ]);
    $style
      ->addImageEffect($this->effects[$orientation]);
    $this
      ->assertTrue($style
      ->save());
  }
}