Skip to content

Commit

Permalink
Merge branch '6.7' into 6.12
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Nov 15, 2017
2 parents de0fb80 + 470b161 commit 70824ba
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
24 changes: 22 additions & 2 deletions eZ/Publish/API/Repository/Tests/ObjectStateServiceTest.php
Expand Up @@ -614,6 +614,9 @@ public function testUpdateObjectStateGroup()
$objectStateGroupId
);

// pre populate any kind of cache for all
$objectStateService->loadObjectStateGroups();

$groupUpdateStruct = $objectStateService->newObjectStateGroupUpdateStruct();
$groupUpdateStruct->identifier = 'sindelfingen';
$groupUpdateStruct->defaultLanguageCode = 'ger-DE';
Expand All @@ -630,6 +633,8 @@ public function testUpdateObjectStateGroup()
$loadedObjectStateGroup,
$groupUpdateStruct
);

$allObjectGroups = $objectStateService->loadObjectStateGroups();
/* END: Use Case */

$this->assertInstanceOf(
Expand All @@ -641,6 +646,7 @@ public function testUpdateObjectStateGroup()
$loadedObjectStateGroup,
$groupUpdateStruct,
$updatedObjectStateGroup,
$allObjectGroups,
);
}

Expand Down Expand Up @@ -747,13 +753,17 @@ public function testUpdateObjectStateGroupStructValues(array $testData)
list(
$loadedObjectStateGroup,
$groupUpdateStruct,
$updatedObjectStateGroup
$updatedObjectStateGroup,
$allObjectGroups
) = $testData;

$this->assertStructPropertiesCorrect(
$groupUpdateStruct,
$updatedObjectStateGroup
);

$this->assertContains($updatedObjectStateGroup, $allObjectGroups, '', false, false);
$this->assertNotContains($loadedObjectStateGroup, $allObjectGroups, '', false, false);
}

/**
Expand Down Expand Up @@ -1222,6 +1232,9 @@ public function testUpdateObjectState()
$objectStateId
);

// pre load any possile cache loading all
$objectStateService->loadObjectStates($loadedObjectState->getObjectStateGroup());

$updateStateStruct = $objectStateService->newObjectStateUpdateStruct();
$updateStateStruct->identifier = 'somehow_locked';
$updateStateStruct->defaultLanguageCode = 'ger-DE';
Expand All @@ -1238,6 +1251,8 @@ public function testUpdateObjectState()
$loadedObjectState,
$updateStateStruct
);

$allObjectStates = $objectStateService->loadObjectStates($loadedObjectState->getObjectStateGroup());
/* END: Use Case */

$this->assertInstanceOf(
Expand All @@ -1249,6 +1264,7 @@ public function testUpdateObjectState()
$loadedObjectState,
$updateStateStruct,
$updatedObjectState,
$allObjectStates,
);
}

Expand Down Expand Up @@ -1352,7 +1368,8 @@ public function testUpdateObjectStateStructValues(array $testData)
list(
$loadedObjectState,
$updateStateStruct,
$updatedObjectState
$updatedObjectState,
$allObjectStates
) = $testData;

$this->assertPropertiesCorrect(
Expand All @@ -1372,6 +1389,9 @@ public function testUpdateObjectStateStructValues(array $testData)
$loadedObjectState->getObjectStateGroup(),
$updatedObjectState->getObjectStateGroup()
);

$this->assertContains($updatedObjectState, $allObjectStates, '', false, false);
$this->assertNotContains($loadedObjectState, $allObjectStates, '', false, false);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions eZ/Publish/Core/Persistence/Cache/ObjectStateHandler.php
Expand Up @@ -96,6 +96,7 @@ public function updateGroup($groupId, InputStruct $input)
$this->logger->logCall(__METHOD__, array('groupId' => $groupId, 'struct' => $input));
$return = $this->persistenceHandler->objectStateHandler()->updateGroup($groupId, $input);

$this->cache->clear('objectstategroup', 'all');
$this->cache->clear('objectstategroup', $groupId);

return $return;
Expand Down Expand Up @@ -163,6 +164,7 @@ public function update($stateId, InputStruct $input)
$return = $this->persistenceHandler->objectStateHandler()->update($stateId, $input);

$this->cache->clear('objectstate', $stateId);
$this->cache->clear('objectstate', 'byGroup');

return $return;
}
Expand Down
Expand Up @@ -467,6 +467,10 @@ public function testUpdateGroup()
$this->cacheMock
->expects($this->at(0))
->method('clear')
->with('objectstategroup', 'all');
$this->cacheMock
->expects($this->at(1))
->method('clear')
->with('objectstategroup', 1);

$handler = $this->persistenceCacheHandler->objectStateHandler();
Expand Down Expand Up @@ -711,6 +715,11 @@ public function testUpdate()
->method('clear')
->with('objectstate', $expectedState->id);

$this->cacheMock
->expects($this->at(1))
->method('clear')
->with('objectstate', 'byGroup');

$handler = $this->persistenceCacheHandler->objectStateHandler();
$state = $handler->update($expectedState->id, $inputStruct);
$this->assertEquals($state, $expectedState);
Expand Down

0 comments on commit 70824ba

Please sign in to comment.