diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php index 316b750..16963eb 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php @@ -347,6 +347,37 @@ function testEditEffect() { } /** + * Test flush user interface. + */ + public function testFlushUserInterface() { + $admin_path = 'admin/config/media/image-styles'; + + // Create a new style. + $style_name = strtolower($this->randomName(10)); + $style = entity_create('image_style', array('name' => $style_name, 'label' => $this->randomString())); + $style->save(); + + // Create an image to make sure it gets flushed. + $image_uri = $this->createSampleImage($style); + $derivative_uri = $style->buildUri($image_uri); + $style->createDerivative($image_uri, $derivative_uri); + //$this->drupalGet($style->buildUrl($image_uri)); + $this->assertEqual($this->getImageCount($style), 1); + + // 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->assertLinkByHref($flush_path); + + // Flush the image style derivatives using the user interface. + $this->drupalPostForm($flush_path, array(), t('Flush')); + + // The derivative image file should have been deleted. + $this->assertEqual($this->getImageCount($style), 0); + } + + /** * Tests image style configuration import that does a delete. */ function testConfigImport() {