Issue #2849413 by sam-elayyoub, idebr, tatarbj, B N Pandey, annetee, developmenticon, borisson_, Lendude: Class name must be a valid object or a string in core/modules/image/src/Entity/ImageStyle.php on line 174
parent
ad3be82d58
commit
3237440708
|
|
@ -183,7 +183,10 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface, Entity
|
|||
// source files not stored in the default scheme.
|
||||
if ($source_scheme != $default_scheme) {
|
||||
$class = $this->getStreamWrapperManager()->getClass($source_scheme);
|
||||
$is_writable = $class::getType() & StreamWrapperInterface::WRITE;
|
||||
$is_writable = NULL;
|
||||
if ($class) {
|
||||
$is_writable = $class::getType() & StreamWrapperInterface::WRITE;
|
||||
}
|
||||
|
||||
// Compute the derivative URI scheme. Derivatives created from writable
|
||||
// source stream wrappers will inherit the scheme. Derivatives created
|
||||
|
|
|
|||
|
|
@ -27,4 +27,21 @@ class MediaSourceFileTest extends MediaKernelTestBase {
|
|||
$this->assertCount(0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests a media file can be deleted.
|
||||
*/
|
||||
public function testFileDeletion() {
|
||||
$mediaType = $this->createMediaType('file');
|
||||
$media = $this->generateMedia('test.txt', $mediaType);
|
||||
$media->save();
|
||||
|
||||
$source_field_name = $mediaType->getSource()
|
||||
->getSourceFieldDefinition($mediaType)
|
||||
->getName();
|
||||
/** @var \Drupal\file\FileInterface $file */
|
||||
$file = $media->get($source_field_name)->entity;
|
||||
$file->delete();
|
||||
$this->assertEmpty($this->container->get('entity_type.manager')->getStorage('file')->loadByProperties(['filename' => 'test.txt']));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue