private function SanitizerHelperTest::prepareFile in SVG Upload Sanitizer 8
3 calls to SanitizerHelperTest::prepareFile()
- SanitizerHelperTest::testSanitize in tests/
src/ Unit/ Helper/ SanitizerHelperTest.php - SanitizerHelperTest::testSanitizeWhenFileDoesNotExist in tests/
src/ Unit/ Helper/ SanitizerHelperTest.php - SanitizerHelperTest::testSanitizeWhenRealpathIsNotResolved in tests/
src/ Unit/ Helper/ SanitizerHelperTest.php
File
- tests/
src/ Unit/ Helper/ SanitizerHelperTest.php, line 91
Class
- SanitizerHelperTest
- Unit test class for the SanitizeHelper class.
Namespace
Drupal\Tests\svg_upload_sanitizer\Unit\HelperCode
private function prepareFile($pathIsResolved, $filePathExists = FALSE) {
$filePath = $filePathExists ? sprintf('%s/fixtures/image.svg', __DIR__) : 'something/that/will/never/exists.casper';
$fileUri = 'public://fileuri';
$file = $this
->createMock(FileInterface::class);
$file
->expects($this
->atLeastOnce())
->method('getMimeType')
->willReturn('image/svg+xml');
$file
->expects($this
->atLeastOnce())
->method('getFileUri')
->willReturn($fileUri);
$this->fileSystem
->expects($this
->atLeastOnce())
->method('realpath')
->with($fileUri)
->willReturn($pathIsResolved ? $filePath : FALSE);
return [
$file,
$filePath,
];
}