public function AssetImageHelperTest::testGetFallbackThumbnail in Media: Acquia DAM 8
Validate that a fallback image can be found.
File
- tests/
src/ Unit/ AssetImageHelperTest.php, line 79
Class
- AssetImageHelperTest
- Tests integration of the AssetImageHelper service.
Namespace
Drupal\Tests\media_acquiadam\UnitCode
public function testGetFallbackThumbnail() {
// First FALSE will trigger the set thumbnail method.
// Second FALSE will trigger the file copy.
// TRUE will trigger using the default.
$this->assetImageHelper
->method('phpFileExists')
->with('public://webdam.png')
->willReturnOnConsecutiveCalls(FALSE, FALSE, TRUE);
$this
->assertEquals('public://webdam.png_copy', $this->assetImageHelper
->getFallbackThumbnail(), 'File should be copied to new location');
$this
->assertEquals('public://webdam.png', $this->assetImageHelper
->getFallbackThumbnail(), 'Existing file should be used');
}