function ImageAdminStylesTest::testFlushUserInterface
Same name in other branches
- 8.9.x core/modules/image/tests/src/Functional/ImageAdminStylesTest.php \Drupal\Tests\image\Functional\ImageAdminStylesTest::testFlushUserInterface()
- 10 core/modules/image/tests/src/Functional/ImageAdminStylesTest.php \Drupal\Tests\image\Functional\ImageAdminStylesTest::testFlushUserInterface()
- 11.x core/modules/image/tests/src/Functional/ImageAdminStylesTest.php \Drupal\Tests\image\Functional\ImageAdminStylesTest::testFlushUserInterface()
Tests flush user interface.
File
-
core/
modules/ image/ tests/ src/ Functional/ ImageAdminStylesTest.php, line 440
Class
- ImageAdminStylesTest
- Tests creation, deletion, and editing of image styles and effects.
Namespace
Drupal\Tests\image\FunctionalCode
public function testFlushUserInterface() {
$admin_path = 'admin/config/media/image-styles';
// Create a new style.
$style_name = strtolower($this->randomMachineName(10));
$style = ImageStyle::create([
'name' => $style_name,
'label' => $this->randomString(),
]);
$style->save();
// Create an image to make sure it gets flushed.
$files = $this->drupalGetTestFiles('image');
$image_uri = $files[0]->uri;
$derivative_uri = $style->buildUri($image_uri);
$this->assertTrue($style->createDerivative($image_uri, $derivative_uri));
$this->assertEquals(1, $this->getImageCount($style));
// Go to image styles list page and check if the flush operation link
// exists.
$this->drupalGet($admin_path);
$flush_path = $admin_path . '/manage/' . $style_name . '/flush';
$this->assertSession()
->linkByHrefExists($flush_path);
// Flush the image style derivatives using the user interface.
$this->drupalGet($flush_path);
$this->submitForm([], 'Flush');
// The derivative image file should have been deleted.
$this->assertEquals(0, $this->getImageCount($style));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.