diff --git a/src/lib/Helper/ContentPreviewHelper.php b/src/lib/Helper/ContentPreviewHelper.php index e381d2ad72..ae32cedc11 100644 --- a/src/lib/Helper/ContentPreviewHelper.php +++ b/src/lib/Helper/ContentPreviewHelper.php @@ -98,6 +98,7 @@ public function isPreviewActive() public function setPreviewActive($previewActive) { $this->previewActive = (bool)$previewActive; + $this->originalSiteAccess = clone $this->originalSiteAccess; } /** diff --git a/tests/lib/Helper/ContentPreviewHelperTest.php b/tests/lib/Helper/ContentPreviewHelperTest.php index 8a4ea1a5e7..c177ece44e 100644 --- a/tests/lib/Helper/ContentPreviewHelperTest.php +++ b/tests/lib/Helper/ContentPreviewHelperTest.php @@ -78,11 +78,16 @@ public function testRestoreConfigScope() public function testPreviewActive() { + $originalSiteAccess = new SiteAccess('foo', 'bar'); + $this->previewHelper->setSiteAccess($originalSiteAccess); + $this->assertFalse($this->previewHelper->isPreviewActive()); $this->previewHelper->setPreviewActive(true); $this->assertTrue($this->previewHelper->isPreviewActive()); $this->previewHelper->setPreviewActive(false); $this->assertFalse($this->previewHelper->isPreviewActive()); + + self::assertNotSame($originalSiteAccess, $this->previewHelper->getOriginalSiteAccess()); } public function testPreviewedContent()