Skip to content

Commit

Permalink
Applying CR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbieniek committed Nov 25, 2024
1 parent 9aa1131 commit e04b7fb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
21 changes: 11 additions & 10 deletions eZ/Publish/Core/Persistence/Cache/Tests/ContentHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function providerForUnCachedMethods(): array
['setStatus', [2, 0, 1], [['content_version', [2, 1], false]], null, ['c-2-v-1']],
['setStatus', [2, 1, 1], [['content', [2], false]], null, ['c-2']],
['updateMetadata', [2, new MetadataUpdateStruct()], [['content', [2], false]], null, ['c-2']],
//['updateContent', [2, 1, new UpdateStruct()], [['content_version', [2, 1], false]], null, ['c-2-v-1']],
['updateContent', [2, 1, new UpdateStruct()], [['content_version', [2, 1], false]], null, ['c-2-v-1']],
//['deleteContent', [2]], own tests for relations complexity
['deleteVersion', [2, 1], [['content_version', [2, 1], false]], null, ['c-2-v-1']],
['addRelation', [new RelationCreateStruct()]],
Expand Down Expand Up @@ -308,7 +308,7 @@ public function providerForCachedLoadMethodsMiss(): array
/**
* @covers \eZ\Publish\Core\Persistence\Cache\ContentHandler::updateContent
*/
public function testUpdateContent()
public function testUpdateContent(): void
{
$this->loggerMock->expects($this->once())->method('logCall');

Expand All @@ -332,14 +332,15 @@ public function testUpdateContent()
$this->cacheIdentifierGeneratorMock
->expects($this->exactly(5))
->method('generateTag')
->withConsecutive(
['location', [3], false],
['location', [4], false],
['location_path', [3], false],
['location_path', [4], false],
['content_version', [2, 1], false],
)
->willReturnOnConsecutiveCalls('l-3', 'l-4', 'lp-3', 'lp-4', 'c-2-v-1');
->will(
self::returnValueMap([
['location', [3], false, 'l-3'],
['location', [4], false, 'l-4'],
['location_path', [3], false, 'lp-3'],
['location_path', [4], false, 'lp-4'],
['content_version', [2, 1], false, 'c-2-v-1'],
])
);

$this->cacheMock
->expects($this->once())
Expand Down
7 changes: 4 additions & 3 deletions eZ/Publish/Core/Persistence/Cache/TrashHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ public function trashSubtree($locationId)

$location = $this->persistenceHandler->locationHandler()->load($locationId);
$contentId = $location->contentId;
$reverseRelations = $this->persistenceHandler->contentHandler()->loadRelations($contentId);
$versions = $this->persistenceHandler->contentHandler()->listVersions($contentId);
$contentHandler = $this->persistenceHandler->contentHandler();
$reverseRelations = $contentHandler->loadRelations($contentId);
$versions = $contentHandler->listVersions($contentId);
$return = $this->persistenceHandler->trashHandler()->trashSubtree($locationId);

$relationTags = [];
Expand All @@ -56,7 +57,7 @@ public function trashSubtree($locationId)
}

$versionTags = array_map(function (VersionInfo $versionInfo) use ($contentId): string {
return $this->cacheIdentifierGenerator->generateTag(
return $this->cacheIdentifierGenerator->generateTag(
self::CONTENT_VERSION_IDENTIFIER,
[$contentId, $versionInfo->versionNo]
);
Expand Down

0 comments on commit e04b7fb

Please sign in to comment.