From 0df9079d5e90aea82a71c14a105b9c9172e8fcd3 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 17 May 2024 14:41:29 +0200 Subject: [PATCH] TASK: Revert using Connection instead of DbalClient in test will be part of https://github.com/neos/neos-development-collection/pull/5005 --- ...ectionIntegrityViolationDetectionTrait.php | 25 +++++++++---------- .../Behavior/Bootstrap/FeatureContext.php | 3 ++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php b/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php index 126e0b914f8..873a700ea17 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php @@ -15,7 +15,6 @@ namespace Neos\ContentGraph\DoctrineDbalAdapter\Tests\Behavior\Features\Bootstrap; use Behat\Gherkin\Node\TableNode; -use Doctrine\DBAL\Connection; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Exception\InvalidArgumentException; use Neos\ContentGraph\DoctrineDbalAdapter\ContentGraphTableNames; @@ -42,7 +41,7 @@ trait ProjectionIntegrityViolationDetectionTrait { use CRTestSuiteRuntimeVariables; - private Connection $dbal; + private DoctrineDbalClient $dbalClient; protected Result $lastIntegrityViolationDetectionResult; @@ -63,7 +62,7 @@ private function tableNames(): ContentGraphTableNames public function setupDbalGraphAdapterIntegrityViolationTrait() { - $this->dbal = $this->getObject(Connection::class); + $this->dbalClient = $this->getObject(DoctrineDbalClient::class); } /** @@ -81,7 +80,7 @@ public function iRemoveTheFollowingSubtreeTag(TableNode $payloadTable): void if (!$subtreeTags->contain($subtreeTagToRemove)) { throw new \RuntimeException(sprintf('Failed to remove subtree tag "%s" because that tag is not set', $subtreeTagToRemove->value), 1708618267); } - $this->dbal->update( + $this->dbalClient->getConnection()->update( $this->tableNames()->hierarchyRelation(), [ 'subtreetags' => json_encode($subtreeTags->without($subtreeTagToRemove), JSON_THROW_ON_ERROR | JSON_FORCE_OBJECT), @@ -98,7 +97,7 @@ public function iAddTheFollowingHierarchyRelation(TableNode $payloadTable): void { $dataset = $this->transformPayloadTableToDataset($payloadTable); $record = $this->transformDatasetToHierarchyRelationRecord($dataset); - $this->dbal->insert( + $this->dbalClient->getConnection()->insert( $this->tableNames()->hierarchyRelation(), $record ); @@ -115,7 +114,7 @@ public function iChangeTheFollowingHierarchyRelationsDimensionSpacePointHash(Tab $record = $this->transformDatasetToHierarchyRelationRecord($dataset); unset($record['position']); - $this->dbal->update( + $this->dbalClient->getConnection()->update( $this->tableNames()->hierarchyRelation(), [ 'dimensionspacepointhash' => $dataset['newDimensionSpacePointHash'] @@ -133,7 +132,7 @@ public function iChangeTheFollowingNodesName(TableNode $payloadTable): void { $dataset = $this->transformPayloadTableToDataset($payloadTable); - $relationAnchorPoint = $this->dbal->executeQuery( + $relationAnchorPoint = $this->dbalClient->getConnection()->executeQuery( 'SELECT n.relationanchorpoint FROM ' . $this->tableNames()->node() . ' n JOIN ' . $this->tableNames()->hierarchyRelation() . ' h ON h.childnodeanchor = n.relationanchorpoint WHERE h.contentstreamid = :contentStreamId @@ -146,7 +145,7 @@ public function iChangeTheFollowingNodesName(TableNode $payloadTable): void ] )->fetchOne(); - $this->dbal->update( + $this->dbalClient->getConnection()->update( $this->tableNames()->node(), [ 'name' => $dataset['newName'] @@ -172,7 +171,7 @@ public function iSetTheFollowingPosition(TableNode $payloadTable): void 'childnodeanchor' => $this->findRelationAnchorPointByDataset($dataset) ]; - $this->dbal->update( + $this->dbalClient->getConnection()->update( $this->tableNames()->hierarchyRelation(), [ 'position' => $dataset['newPosition'] @@ -190,7 +189,7 @@ public function iDetachTheFollowingReferenceRelationFromItsSource(TableNode $pay { $dataset = $this->transformPayloadTableToDataset($payloadTable); - $this->dbal->update( + $this->dbalClient->getConnection()->update( $this->tableNames()->referenceRelation(), [ 'nodeanchorpoint' => 7777777 @@ -208,7 +207,7 @@ public function iSetTheFollowingReferencePosition(TableNode $payloadTable): void { $dataset = $this->transformPayloadTableToDataset($payloadTable); - $this->dbal->update( + $this->dbalClient->getConnection()->update( $this->tableNames()->referenceRelation(), [ 'position' => $dataset['newPosition'] @@ -278,7 +277,7 @@ private function findHierarchyRelationByIds( DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $nodeAggregateId ): array { - $nodeRecord = $this->dbal->executeQuery( + $nodeRecord = $this->dbalClient->getConnection()->executeQuery( 'SELECT h.* FROM ' . $this->tableNames()->node() . ' n INNER JOIN ' . $this->tableNames()->hierarchyRelation() . ' h @@ -314,7 +313,7 @@ private function transformPayloadTableToDataset(TableNode $payloadTable): array */ public function iRunIntegrityViolationDetection(): void { - $projectionIntegrityViolationDetectionRunner = $this->getContentRepositoryService(new DoctrineDbalProjectionIntegrityViolationDetectionRunnerFactory($this->getObject(DoctrineDbalClient::class))); + $projectionIntegrityViolationDetectionRunner = $this->getContentRepositoryService(new DoctrineDbalProjectionIntegrityViolationDetectionRunnerFactory($this->dbalClient)); $this->lastIntegrityViolationDetectionResult = $projectionIntegrityViolationDetectionRunner->run(); } diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Bootstrap/FeatureContext.php b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Bootstrap/FeatureContext.php index 682bf3c0d66..4f59e07af74 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Bootstrap/FeatureContext.php +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Bootstrap/FeatureContext.php @@ -29,6 +29,7 @@ use Neos\ContentRepository\Core\Factory\ContentRepositoryServiceFactoryInterface; use Neos\ContentRepository\Core\Factory\ContentRepositoryServiceInterface; use Neos\ContentRepository\Core\Feature\NodeModification\Dto\PropertyValuesToWrite; +use Neos\ContentRepository\Core\Infrastructure\DbalClientInterface; use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; use Neos\ContentRepository\Core\Tests\Behavior\Fixtures\DayOfWeek; use Neos\ContentRepository\Core\Tests\Behavior\Fixtures\PostalAddress; @@ -59,7 +60,7 @@ public function __construct() { self::bootstrapFlow(); - $this->dbal = $this->getObject(Connection::class); + $this->dbalClient = $this->getObject(DbalClientInterface::class); $this->setUpInterleavingLogger(); $this->contentRepositoryRegistry = $this->getObject(ContentRepositoryRegistry::class); }