From 447c4dcc1530e4ae1305d727953376c766da00c1 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 10 Dec 2024 08:40:46 +0100 Subject: [PATCH] TASK: Ensure pure dbal repositories are pruned --- .../Behavior/Features/Bootstrap/AssetUsageTrait.php | 12 +++++++++++- .../Features/Bootstrap/WorkspaceServiceTrait.php | 11 +++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Neos.Neos/Tests/Behavior/Features/Bootstrap/AssetUsageTrait.php b/Neos.Neos/Tests/Behavior/Features/Bootstrap/AssetUsageTrait.php index 53d5e61c49f..12671d99f9c 100644 --- a/Neos.Neos/Tests/Behavior/Features/Bootstrap/AssetUsageTrait.php +++ b/Neos.Neos/Tests/Behavior/Features/Bootstrap/AssetUsageTrait.php @@ -36,6 +36,16 @@ trait AssetUsageTrait */ abstract private function getObject(string $className): object; + /** + * @BeforeScenario + */ + final public function pruneAssetUsage(): void + { + foreach (static::$alreadySetUpContentRepositories as $contentRepositoryId) { + $this->getObject(\Neos\Neos\AssetUsage\Domain\AssetUsageRepository::class)->removeAll($contentRepositoryId); + } + } + /** * @Then I expect the AssetUsageService to have the following AssetUsages: */ @@ -75,4 +85,4 @@ public function iRunTheAssetUsageIndexingProcessor(string $rootNodeTypeName) NodeTypeName::fromString($rootNodeTypeName), ); } -} \ No newline at end of file +} diff --git a/Neos.Neos/Tests/Behavior/Features/Bootstrap/WorkspaceServiceTrait.php b/Neos.Neos/Tests/Behavior/Features/Bootstrap/WorkspaceServiceTrait.php index af046a39443..faeb26c5337 100644 --- a/Neos.Neos/Tests/Behavior/Features/Bootstrap/WorkspaceServiceTrait.php +++ b/Neos.Neos/Tests/Behavior/Features/Bootstrap/WorkspaceServiceTrait.php @@ -48,6 +48,17 @@ trait WorkspaceServiceTrait */ abstract private function getObject(string $className): object; + /** + * @BeforeScenario + */ + final public function pruneWorkspaceService(): void + { + foreach (static::$alreadySetUpContentRepositories as $contentRepositoryId) { + $this->getObject(\Neos\Neos\Domain\Repository\WorkspaceMetadataAndRoleRepository::class)->pruneWorkspaceMetadata($contentRepositoryId); + $this->getObject(\Neos\Neos\Domain\Repository\WorkspaceMetadataAndRoleRepository::class)->pruneRoleAssignments($contentRepositoryId); + } + } + /** * @When the root workspace :workspaceName is created * @When the root workspace :workspaceName with title :title and description :description is created