trait AcquiadamAssetImageHelperTrait in Media: Acquia DAM 8
Shared methods for dealing with a mocked AssetImageHelper.
Hierarchy
- trait \Drupal\Tests\media_acquiadam\Traits\AcquiadamAssetImageHelperTrait
1 file declares its use of AcquiadamAssetImageHelperTrait
- AssetFileEntityHelperTest.php in tests/
src/ Unit/ AssetFileEntityHelperTest.php
File
- tests/
src/ Traits/ AcquiadamAssetImageHelperTrait.php, line 10
Namespace
Drupal\Tests\media_acquiadam\TraitsView source
trait AcquiadamAssetImageHelperTrait {
/**
* Create a stub AssetImageHelper that implements some basic functions.
*
* @return \Drupal\media_acquiadam\Service\AssetImageHelper|\PHPUnit\Framework\MockObject\MockObject
* The stubbed service.
*/
public function getAssetImageHelperStub() {
$asset_image_helper = $this
->getMockBuilder(AssetImageHelper::class)
->disableOriginalConstructor()
->getMock();
$asset_image_helper
->method('getMimeTypeFromFileType')
->willReturnMap([
[
'jpg',
[
'discrete' => 'image',
'sub' => 'jpg',
],
],
[
'mov',
[
'discrete' => 'quicktime',
'sub' => 'mov',
],
],
[
'pdf',
[
'discrete' => 'application',
'sub' => 'pdf',
],
],
]);
$asset_image_helper
->method('getThumbnailUrlBySize')
->willReturn('http://subdomain.webdamdb.com/s/310th_sm_0UerYozlI3.jpg');
return $asset_image_helper;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AcquiadamAssetImageHelperTrait:: |
public | function | Create a stub AssetImageHelper that implements some basic functions. |