Skip to content
Snippets Groups Projects

Issue #3000950: Sample images cannot be generated while in a non-default workspace

1 file
+ 31
0
Compare changes
  • Side-by-side
  • Inline
@@ -3,9 +3,13 @@
namespace Drupal\Tests\workspaces\Kernel;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Form\FormState;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\entity_test\Entity\EntityTestMulRevPub;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\KernelTests\KernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\system\Form\SiteInformationForm;
@@ -822,6 +826,33 @@ public function testExecuteInWorkspaceContext() {
$this->assertFalse($this->workspaceManager->getActiveWorkspace());
}
/**
* Tests creating a sample image item in a non-default workspace.
*/
public function testImageItemSampleValue(): void {
\Drupal::service('module_installer')->install(['image']);
$this->initializeWorkspacesModule();
FieldStorageConfig::create([
'entity_type' => 'entity_test',
'field_name' => 'image_test',
'type' => 'image',
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
])->save();
FieldConfig::create([
'entity_type' => 'entity_test',
'field_name' => 'image_test',
'bundle' => 'entity_test',
'settings' => [
'file_extensions' => 'jpg',
],
])->save();
$this->switchToWorkspace('stage');
$entity = EntityTest::create();
$entity->image_test->generateSampleItems();
}
/**
* Checks entity load, entity queries and views results for a test scenario.
*
Loading