Skip to content

Commit

Permalink
Fix tests after merge issue
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Oct 19, 2018
1 parent 3fa8c00 commit e701b2b
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions eZ/Publish/Core/Repository/Tests/Service/Mock/ContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5835,40 +5835,19 @@ protected function mockSetDefaultObjectStates()
*/
protected function mockPublishVersion($publicationDate = null, $modificationDate = null)
{
$versionInfoMock = $this->createMock(APIVersionInfo::class);
$contentInfoMock = $this->createMock(APIContentInfo::class);
/* @var \PHPUnit\Framework\MockObject\MockObject $contentHandlerMock */
$contentHandlerMock = $this->getPersistenceMock()->contentHandler();
$metadataUpdateStruct = new SPIMetadataUpdateStruct();

$currentTime = time();
if ($publicationDate === null && $versionInfoMock->versionNo === 1) {
$publicationDate = $currentTime;
}

// Account for 1 second of test execution time
$metadataUpdateStruct->publicationDate = $publicationDate;
$metadataUpdateStruct->modificationDate = $currentTime;
$metadataUpdateStruct2 = clone $metadataUpdateStruct;
++$metadataUpdateStruct2->publicationDate;
++$metadataUpdateStruct2->modificationDate;

$spiContent = new SPIContent([
'versionInfo' => new VersionInfo([
'contentInfo' => new ContentInfo(['id' => 42, 'contentTypeId' => 123]),
]),
]);
$contentHandlerMock->expects($this->once())
->method('publish')
->with(
42,
123,
$this->logicalOr($metadataUpdateStruct, $metadataUpdateStruct2)
)
->will($this->returnValue($spiContent));

$contentMock = $this->mockBuildContentDomainObject($spiContent);
$versionInfoMock = $this->createMock(APIVersionInfo::class);
$contentInfoMock = $this->createMock(APIContentInfo::class);

$contentMock->expects($this->any())
->method('__get')
->will(
Expand Down Expand Up @@ -5915,7 +5894,6 @@ protected function mockPublishVersion($publicationDate = null, $modificationDate
$metadataUpdateStruct->publicationDate = $publicationDate;
$metadataUpdateStruct->modificationDate = $modificationDate ?? $currentTime;

$spiContent = new SPIContent();
$contentHandlerMock->expects($this->once())
->method('publish')
->with(
Expand All @@ -5925,11 +5903,6 @@ protected function mockPublishVersion($publicationDate = null, $modificationDate
)
->will($this->returnValue($spiContent));

$domainMapperMock->expects($this->once())
->method('buildContentDomainObject')
->with($spiContent)
->will($this->returnValue($contentMock));

/* @var \eZ\Publish\API\Repository\Values\Content\Content $contentMock */
$this->mockPublishUrlAliasesForContent($contentMock);

Expand Down

0 comments on commit e701b2b

Please sign in to comment.