Chris@16: drupalGetTestFiles('image'))); Chris@16: Chris@16: // Create derivative image. Chris@16: $styles = ImageStyle::loadMultiple(); Chris@16: $style = reset($styles); Chris@16: $original_uri = $file->getFileUri(); Chris@16: $derivative_uri = $style->buildUri($original_uri); Chris@16: $style->createDerivative($original_uri, $derivative_uri); Chris@16: Chris@16: // Check if derivative image exists. Chris@16: $this->assertTrue(file_exists($derivative_uri), 'Make sure derivative image is generated successfully.'); Chris@16: Chris@16: // Clone the object so we don't have to worry about the function changing Chris@16: // our reference copy. Chris@16: $desired_filepath = 'public://' . $this->randomMachineName(); Chris@18: $result = file_move(clone $file, $desired_filepath, FileSystemInterface::EXISTS_ERROR); Chris@16: Chris@16: // Check if image has been moved. Chris@16: $this->assertTrue(file_exists($result->getFileUri()), 'Make sure image is moved successfully.'); Chris@16: Chris@16: // Check if derivative image has been flushed. Chris@16: $this->assertFalse(file_exists($derivative_uri), 'Make sure derivative image has been flushed.'); Chris@16: } Chris@16: Chris@16: }