Skip to content
Snippets Groups Projects
Verified Commit 32374407 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #2849413 by sam-elayyoub, idebr, tatarbj, B N Pandey, annetee,...

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 ad3be82d
No related branches found
No related tags found
No related merge requests found
......@@ -183,7 +183,10 @@ public function buildUri($uri) {
// 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 @@ public function testFileExtensionConstraint() {
$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']));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment