[TASK] Deprecate PageRepository->versioningPreview 47/57047/9
authorBenni Mack <benni@typo3.org>
Fri, 25 May 2018 08:40:05 +0000 (10:40 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 30 May 2018 20:39:03 +0000 (22:39 +0200)
PageRepository has two public properties regarding
fetching records for versioned records:
- versioningPreview (bool)
- versioningWorkspaceId (int)

In order to allow previews of versions, a workspace ID
has to be set - otherwise it fetches live records.

Basically things like: $versioningPreview=false,
$versioningWorkspaceId=3 will make things more confusing.

Instead, versioningPreview is not in use anymore,
and PageRepository solely relies on the parameter
of the workspaceId set.

Resolves: #85078
Releases: master
Change-Id: I70f028854ebc1a83d6d5af18de507284ae89b2ac
Reviewed-on: https://review.typo3.org/57047
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
13 files changed:
typo3/sysext/core/Classes/Database/Query/Restriction/FrontendWorkspaceRestriction.php
typo3/sysext/core/Classes/Utility/RootlineUtility.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-85078-PageRepositoryVersioningPreview.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendRestrictionContainerTest.php
typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendWorkspaceRestrictionTest.php
typo3/sysext/core/Tests/Unit/Utility/RootlineUtilityTest.php
typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbBackendTest.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Page/PageRepository.php
typo3/sysext/frontend/Tests/Functional/Page/PageRepositoryTest.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php

index 4465c07..dc724a8 100644 (file)
@@ -41,13 +41,13 @@ class FrontendWorkspaceRestriction implements QueryRestrictionInterface
 
     /**
      * @param int $workspaceId (PageRepository::$versioningWorkspaceId property)
-     * @param bool $includeRowsForWorkspacePreview (PageRepository::$versioningPreview property)
+     * @param bool $includeRowsForWorkspacePreview (PageRepository::$versioningWorkspaceId > 0 property)
      * @param bool $enforceLiveRowsOnly (!$noVersionPreview argument from PageRepository::enableFields()) This is ONLY for use in PageRepository class and most likely will be removed
      */
     public function __construct(int $workspaceId = null, bool $includeRowsForWorkspacePreview = null, bool $enforceLiveRowsOnly = true)
     {
         $this->workspaceId = $workspaceId ?? $GLOBALS['TSFE']->sys_page->versioningWorkspaceId;
-        $this->includeRowsForWorkspacePreview = $includeRowsForWorkspacePreview ?? $GLOBALS['TSFE']->sys_page->versioningPreview;
+        $this->includeRowsForWorkspacePreview = $includeRowsForWorkspacePreview ?? $GLOBALS['TSFE']->sys_page->versioningWorkspaceId > 0;
         $this->enforceLiveRowsOnly = $enforceLiveRowsOnly;
     }
 
index e948a95..5c8b7fd 100644 (file)
@@ -51,11 +51,6 @@ class RootlineUtility
     protected $workspaceUid = 0;
 
     /**
-     * @var bool
-     */
-    protected $versionPreview = false;
-
-    /**
      * @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
      */
     protected static $cache = null;
@@ -144,7 +139,6 @@ class RootlineUtility
     {
         $this->languageUid = (int)$this->pageContext->sys_language_uid;
         $this->workspaceUid = (int)$this->pageContext->versioningWorkspaceId;
-        $this->versionPreview = $this->pageContext->versioningPreview;
         if ($this->mountPointParameter !== '') {
             if (!$GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids']) {
                 throw new \RuntimeException('Mount-Point Pages are disabled for this installation. Cannot resolve a Rootline for a page with Mount-Points', 1343462896);
@@ -188,8 +182,7 @@ class RootlineUtility
             $otherUid !== null ? (int)$otherUid : $this->pageUid,
             $mountPointParameter,
             $this->languageUid,
-            $this->workspaceUid,
-            $this->versionPreview ? 1 : 0
+            $this->workspaceUid
         ]);
     }
 
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85078-PageRepositoryVersioningPreview.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85078-PageRepositoryVersioningPreview.rst
new file mode 100644 (file)
index 0000000..25da684
--- /dev/null
@@ -0,0 +1,37 @@
+.. include:: ../../Includes.txt
+
+=======================================================
+Deprecation: #85078 - PageRepository->versioningPreview
+=======================================================
+
+See :issue:`85078`
+
+Description
+===========
+
+The public property :php:`$versioningPreview` in :php:`TYPO3\CMS\Frontend\Page\PageRepository` has been marked
+as deprecated. The property was used in conjunction with :php:`$versioningWorkspaceId` which is set to a workspace
+ID, in order to preview records of a workspace.
+
+In order to ease the functionality for developers, only :php:`$versioningWorkspaceId` is taken into account now,
+without needing to set :php:`$versioningPreview` anymore.
+
+
+Impact
+======
+
+Setting or reading this option will trigger a deprecation entry.
+
+
+Affected Installations
+======================
+
+TYPO3 installations with extensions using this property.
+
+
+Migration
+=========
+
+Just set `$versioningWorkspaceId` and remove any calls to the property.
+
+.. index:: Frontend, PHP-API, FullyScanned
\ No newline at end of file
index 45be6d0..35214f0 100644 (file)
@@ -27,7 +27,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
                 'tableName' => 'aTable',
                 'tableAlias' => 'aTable',
                 'workspaceId' => 0,
-                'workspacePreview' => false,
                 'hiddenPagePreview' => false,
                 'hiddenRecordPreview' => false,
                 'feGroupList' => '0,-1',
@@ -37,7 +36,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
                 'tableName' => 'aTable',
                 'tableAlias' => 'aTable',
                 'workspaceId' => 0,
-                'workspacePreview' => false,
                 'hiddenPagePreview' => true,
                 'hiddenRecordPreview' => true,
                 'feGroupList' => '0,-1',
@@ -47,7 +45,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
                 'tableName' => 'aTable',
                 'tableAlias' => 'aTable',
                 'workspaceId' => 1,
-                'workspacePreview' => true,
                 'hiddenPagePreview' => false,
                 'hiddenRecordPreview' => false,
                 'feGroupList' => '0,-1',
@@ -57,7 +54,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
                 'tableName' => 'aTable',
                 'tableAlias' => 'aTable',
                 'workspaceId' => 1,
-                'workspacePreview' => true,
                 'hiddenPagePreview' => true,
                 'hiddenRecordPreview' => true,
                 'feGroupList' => '0,-1',
@@ -67,7 +63,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
                 'tableName' => 'pages',
                 'tableAlias' => 'pages',
                 'workspaceId' => 0,
-                'workspacePreview' => false,
                 'hiddenPagePreview' => false,
                 'hiddenRecordPreview' => false,
                 'feGroupList' => '0,-1',
@@ -77,7 +72,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
                 'tableName' => 'pages',
                 'tableAlias' => 'pages',
                 'workspaceId' => 0,
-                'workspacePreview' => false,
                 'hiddenPagePreview' => true,
                 'hiddenRecordPreview' => true,
                 'feGroupList' => '0,-1',
@@ -87,7 +81,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
                 'tableName' => 'pages',
                 'tableAlias' => 'pages',
                 'workspaceId' => 1,
-                'workspacePreview' => true,
                 'hiddenPagePreview' => false,
                 'hiddenRecordPreview' => false,
                 'feGroupList' => '0,-1',
@@ -97,7 +90,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
                 'tableName' => 'pages',
                 'tableAlias' => 'pages',
                 'workspaceId' => 1,
-                'workspacePreview' => true,
                 'hiddenPagePreview' => true,
                 'hiddenRecordPreview' => true,
                 'feGroupList' => '0,-1',
@@ -107,7 +99,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
                 'tableName' => 'aTable',
                 'tableAlias' => 'a',
                 'workspaceId' => 0,
-                'workspacePreview' => false,
                 'hiddenPagePreview' => false,
                 'hiddenRecordPreview' => false,
                 'feGroupList' => '0,-1',
@@ -120,7 +111,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
      * @param string $tableName
      * @param string $tableAlias
      * @param int $workspaceId
-     * @param bool $workspacePreview
      * @param bool $hiddenPagePreview
      * @param bool $hiddenRecordPreview
      * @param string $feGroupList
@@ -133,7 +123,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
         string $tableName,
         string $tableAlias,
         int $workspaceId,
-        bool $workspacePreview,
         bool $hiddenPagePreview,
         bool $hiddenRecordPreview,
         string $feGroupList,
@@ -174,7 +163,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
 
         $pageRepository = $this->createMock(PageRepository::class);
         $pageRepository->versioningWorkspaceId = $workspaceId;
-        $pageRepository->versioningPreview = $workspacePreview;
 
         $typoScriptFrontendController = new \stdClass();
         $typoScriptFrontendController->showHiddenPage = $hiddenPagePreview;
index 19a8932..1f2a732 100644 (file)
@@ -28,13 +28,13 @@ class FrontendWorkspaceRestrictionTest extends AbstractRestrictionTestCase
         $GLOBALS['TCA'] = [
             'aTable' => [
                 'ctrl' => [
-                    'versioningWS' => 2,
+                    'versioningWS' => true,
                 ],
             ]
         ];
 
         $pageRepository = $this->createMock(PageRepository::class);
-        $pageRepository->versioningPreview = false;
+        $pageRepository->versioningWorkspaceId = 0;
 
         $GLOBALS['TSFE'] = new \stdClass();
         $GLOBALS['TSFE']->sys_page = $pageRepository;
@@ -52,13 +52,12 @@ class FrontendWorkspaceRestrictionTest extends AbstractRestrictionTestCase
         $GLOBALS['TCA'] = [
             'aTable' => [
                 'ctrl' => [
-                    'versioningWS' => 2,
+                    'versioningWS' => true,
                 ],
             ]
         ];
 
         $pageRepository = $this->createMock(PageRepository::class);
-        $pageRepository->versioningPreview = true;
         $pageRepository->versioningWorkspaceId = 42;
 
         $subject = new FrontendWorkspaceRestriction(42, true);
@@ -74,13 +73,12 @@ class FrontendWorkspaceRestrictionTest extends AbstractRestrictionTestCase
         $GLOBALS['TCA'] = [
             'aTable' => [
                 'ctrl' => [
-                    'versioningWS' => 2,
+                    'versioningWS' => true,
                 ],
             ]
         ];
 
         $pageRepository = $this->createMock(PageRepository::class);
-        $pageRepository->versioningPreview = true;
         $pageRepository->versioningWorkspaceId = 42;
 
         $subject = new FrontendWorkspaceRestriction(42, true, false);
index 07fa74e..681fbc6 100644 (file)
@@ -310,15 +310,13 @@ class RootlineUtilityTest extends UnitTestCase
     {
         $this->pageContextMock->sys_language_uid = 8;
         $this->pageContextMock->versioningWorkspaceId = 15;
-        $this->pageContextMock->versioningPreview = true;
         $this->subject->__construct(42, '47-11', $this->pageContextMock);
-        $this->assertSame('42_47-11_8_15_1', $this->subject->getCacheIdentifier());
-        $this->pageContextMock->versioningPreview = false;
+        $this->assertSame('42_47-11_8_15', $this->subject->getCacheIdentifier());
         $this->subject->__construct(42, '47-11', $this->pageContextMock);
-        $this->assertSame('42_47-11_8_15_0', $this->subject->getCacheIdentifier());
+        $this->assertSame('42_47-11_8_15', $this->subject->getCacheIdentifier());
         $this->pageContextMock->versioningWorkspaceId = 0;
         $this->subject->__construct(42, '47-11', $this->pageContextMock);
-        $this->assertSame('42_47-11_8_0_0', $this->subject->getCacheIdentifier());
+        $this->assertSame('42_47-11_8_0', $this->subject->getCacheIdentifier());
     }
 
     /**
@@ -336,7 +334,6 @@ class RootlineUtilityTest extends UnitTestCase
         );
         $this->pageContextMock->sys_language_uid = 8;
         $this->pageContextMock->versioningWorkspaceId = 15;
-        $this->pageContextMock->versioningPreview = true;
         $this->subject->__construct(42, '47-11,48-12', $this->pageContextMock);
         $this->assertTrue($cacheFrontendMock->isValidEntryIdentifier($this->subject->getCacheIdentifier()));
     }
index 2e752f1..266a7bd 100644 (file)
@@ -73,6 +73,7 @@ class RelationTest extends \TYPO3\TestingFramework\Core\Functional\FunctionalTes
         $this->blog = $blogRepository->findByUid(1);
 
         $GLOBALS['BE_USER'] = new BackendUserAuthentication();
+        $GLOBALS['BE_USER']->workspace = 0;
     }
 
     /**
index 91fb65b..12e76a6 100644 (file)
@@ -152,7 +152,6 @@ class Typo3DbBackendTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $pageRepositoryMock = $this->getMockBuilder(\TYPO3\CMS\Frontend\Page\PageRepository::class)
             ->setMethods(['movePlhOL', 'getWorkspaceVersionOfRecord'])
             ->getMock();
-        $pageRepositoryMock->versioningPreview = true;
         $pageRepositoryMock->expects($this->once())->method('getWorkspaceVersionOfRecord')->with($workspaceUid, 'tx_foo', '42')->will($this->returnValue($workspaceVersion));
         $mockTypo3DbBackend = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::class, ['dummy'], [], '', false);
         $mockTypo3DbBackend->_set('pageRepository', $pageRepositoryMock);
index f1d5292..d1cf44e 100644 (file)
@@ -6716,7 +6716,7 @@ class ContentObjectRenderer implements LoggerAwareInterface
         ];
 
         $considerMovePlaceholders = (
-            $tsfe->sys_page->versioningPreview && $table !== 'pages'
+            $tsfe->sys_page->versioningWorkspaceId > 0 && $table !== 'pages'
             && !empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS'])
         );
 
index 55d96de..8f1e89b 100644 (file)
@@ -1191,7 +1191,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         if ($this->whichWorkspace() > 0) {
             // Fetch overlay of page if in workspace and check if it is hidden
             $pageSelectObject = GeneralUtility::makeInstance(PageRepository::class);
-            $pageSelectObject->versioningPreview = true;
             $pageSelectObject->init(false);
             $targetPage = $pageSelectObject->getWorkspaceVersionOfRecord($this->whichWorkspace(), 'pages', $page['uid']);
             $result = $targetPage === -1 || $targetPage === -2;
@@ -1269,7 +1268,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         $timeTracker->push('fetch_the_id initialize/');
         // Initialize the page-select functions.
         $this->sys_page = GeneralUtility::makeInstance(PageRepository::class);
-        $this->sys_page->versioningPreview = $this->whichWorkspace() > 0 || (bool)GeneralUtility::_GP('ADMCMD_view');
         $this->sys_page->versioningWorkspaceId = $this->whichWorkspace();
         $this->sys_page->init($this->showHiddenPage);
         // Set the valid usergroups for FE
index a468b87..48e2fe8 100644 (file)
@@ -48,6 +48,7 @@ class PageRepository implements LoggerAwareInterface
      * @var array
      */
     protected $deprecatedPublicProperties = [
+        'versioningPreview' => 'Using $versioningPreview of class PageRepository is discouraged, just use versioningWorkspaceId to determine if a workspace should be previewed.',
         'workspaceCache' => 'Using $workspaceCache of class PageRepository from the outside is discouraged, as this only reflects a local runtime cache.',
         'error_getRootLine' => 'Using $error_getRootLine of class PageRepository from the outside is deprecated as this property only exists for legacy reasons.',
         'error_getRootLine_failPid' => 'Using $error_getRootLine_failPid of class PageRepository from the outside is deprecated as this property only exists for legacy reasons.',
@@ -80,11 +81,15 @@ class PageRepository implements LoggerAwareInterface
      * user!!!
      *
      * @var bool
+     * @deprecated since TYPO3 v9.3, will be removed in TYPO3 v10. As $versioningWorkspaceId now indicates what records to fetch.
      */
-    public $versioningPreview = false;
+    protected $versioningPreview = false;
 
     /**
      * Workspace ID for preview
+     * If > 0, versioning preview of other record versions is allowed. THIS MUST
+     * ONLY BE SET IF the page is not cached and truly previewed by a backend
+     * user!
      *
      * @var int
      */
@@ -185,7 +190,7 @@ class PageRepository implements LoggerAwareInterface
     {
         $this->where_groupAccess = '';
 
-        if ($this->versioningPreview) {
+        if ($this->versioningWorkspaceId) {
             // For version previewing, make sure that enable-fields are not
             // de-selecting hidden pages - we need versionOL() to unset them only
             // if the overlay record instructs us to.
@@ -1339,7 +1344,7 @@ class PageRepository implements LoggerAwareInterface
                 $constraints[] = $expressionBuilder->eq($table . '.' . $ctrl['delete'], 0);
             }
             if ($ctrl['versioningWS']) {
-                if (!$this->versioningPreview) {
+                if (!$this->versioningWorkspaceId) {
                     // Filter out placeholder records (new/moved/deleted items)
                     // in case we are NOT in a versioning preview (that means we are online!)
                     $constraints[] = $expressionBuilder->lte(
@@ -1365,7 +1370,7 @@ class PageRepository implements LoggerAwareInterface
             if (is_array($ctrl['enablecolumns'])) {
                 // In case of versioning-preview, enableFields are ignored (checked in
                 // versionOL())
-                if (!$this->versioningPreview || !$ctrl['versioningWS'] || $noVersionPreview) {
+                if (!$this->versioningWorkspaceId || !$ctrl['versioningWS'] || $noVersionPreview) {
                     if (($ctrl['enablecolumns']['disabled'] ?? false) && !$show_hidden && !($ignore_array['disabled'] ?? false)) {
                         $field = $table . '.' . $ctrl['enablecolumns']['disabled'];
                         $constraints[] = $expressionBuilder->eq($field, 0);
@@ -1465,7 +1470,7 @@ class PageRepository implements LoggerAwareInterface
      */
     public function fixVersioningPid($table, &$rr)
     {
-        if ($this->versioningPreview && is_array($rr) && (int)$rr['pid'] === -1 && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
+        if ($this->versioningWorkspaceId && is_array($rr) && (int)$rr['pid'] === -1 && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
             $oid = 0;
             $wsid = 0;
             // Check values for t3ver_oid and t3ver_wsid:
@@ -1545,7 +1550,7 @@ class PageRepository implements LoggerAwareInterface
      */
     public function versionOL($table, &$row, $unsetMovePointers = false, $bypassEnableFieldsCheck = false)
     {
-        if ($this->versioningPreview && is_array($row)) {
+        if ($this->versioningWorkspaceId && is_array($row)) {
             // will overlay any movePlhOL found with the real record, which in turn
             // will be overlaid with its workspace version if any.
             $movePldSwap = $this->movePlhOL($table, $row);
@@ -1683,42 +1688,40 @@ class PageRepository implements LoggerAwareInterface
      */
     public function getMovePlaceholder($table, $uid, $fields = '*')
     {
-        if ($this->versioningPreview) {
-            $workspace = (int)$this->versioningWorkspaceId;
-            if (!empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) && $workspace !== 0) {
-                // Select workspace version of record:
-                $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
-                $queryBuilder->getRestrictions()
-                    ->removeAll()
-                    ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
+        $workspace = (int)$this->versioningWorkspaceId;
+        if (!empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) && $workspace !== 0) {
+            // Select workspace version of record:
+            $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
+            $queryBuilder->getRestrictions()
+                ->removeAll()
+                ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
 
-                $row = $queryBuilder->select(...GeneralUtility::trimExplode(',', $fields, true))
-                    ->from($table)
-                    ->where(
-                        $queryBuilder->expr()->neq('pid', $queryBuilder->createNamedParameter(-1, \PDO::PARAM_INT)),
-                        $queryBuilder->expr()->eq(
-                            't3ver_state',
-                            $queryBuilder->createNamedParameter(
-                                (string)VersionState::cast(VersionState::MOVE_PLACEHOLDER),
-                                \PDO::PARAM_INT
-                            )
-                        ),
-                        $queryBuilder->expr()->eq(
-                            't3ver_move_id',
-                            $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)
-                        ),
-                        $queryBuilder->expr()->eq(
-                            't3ver_wsid',
-                            $queryBuilder->createNamedParameter($workspace, \PDO::PARAM_INT)
+            $row = $queryBuilder->select(...GeneralUtility::trimExplode(',', $fields, true))
+                ->from($table)
+                ->where(
+                    $queryBuilder->expr()->neq('pid', $queryBuilder->createNamedParameter(-1, \PDO::PARAM_INT)),
+                    $queryBuilder->expr()->eq(
+                        't3ver_state',
+                        $queryBuilder->createNamedParameter(
+                            (string)VersionState::cast(VersionState::MOVE_PLACEHOLDER),
+                            \PDO::PARAM_INT
                         )
+                    ),
+                    $queryBuilder->expr()->eq(
+                        't3ver_move_id',
+                        $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)
+                    ),
+                    $queryBuilder->expr()->eq(
+                        't3ver_wsid',
+                        $queryBuilder->createNamedParameter($workspace, \PDO::PARAM_INT)
                     )
-                    ->setMaxResults(1)
-                    ->execute()
-                    ->fetch();
+                )
+                ->setMaxResults(1)
+                ->execute()
+                ->fetch();
 
-                if (is_array($row)) {
-                    return $row;
-                }
+            if (is_array($row)) {
+                return $row;
             }
         }
         return false;
index af41fda..b24b527 100644 (file)
@@ -310,7 +310,6 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
      */
     public function initSetsPublicPropertyCorrectlyForWorkspacePreview()
     {
-        $this->pageRepo->versioningPreview = true;
         $this->pageRepo->versioningWorkspaceId = 2;
         $this->pageRepo->init(false);
 
@@ -333,7 +332,6 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
     {
         $GLOBALS['SIM_ACCESS_TIME'] = 123;
 
-        $this->pageRepo->versioningPreview = false;
         $this->pageRepo->versioningWorkspaceId = 0;
         $this->pageRepo->init(false);
 
@@ -358,29 +356,12 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
     /**
      * @test
      */
-    public function noPagesFromWorkspaceAreShownLive()
-    {
-        // initialization
-        $wsid = 987654321;
-
-        // simulate calls from \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->fetch_the_id()
-        $this->pageRepo->versioningPreview = false;
-        $this->pageRepo->versioningWorkspaceId = $wsid;
-        $this->pageRepo->init(false);
-
-        $this->assertSame([], $this->pageRepo->getPage(11));
-    }
-
-    /**
-     * @test
-     */
     public function previewShowsPagesFromLiveAndCurrentWorkspace()
     {
         // initialization
         $wsid = 987654321;
 
         // simulate calls from \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->fetch_the_id()
-        $this->pageRepo->versioningPreview = true;
         $this->pageRepo->versioningWorkspaceId = $wsid;
         $this->pageRepo->init(false);
 
@@ -402,7 +383,6 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
         $wsid = 987654321;
 
         // simulate calls from \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->fetch_the_id()
-        $this->pageRepo->versioningPreview = true;
         $this->pageRepo->versioningWorkspaceId = $wsid;
         $this->pageRepo->init(false);
 
@@ -431,7 +411,7 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
             ]
         ];
 
-        $this->pageRepo->versioningPreview = false;
+        $this->pageRepo->versioningWorkspaceId = 0;
         $this->pageRepo->init(false);
 
         $conditions = $this->pageRepo->enableFields($table);
@@ -461,7 +441,7 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
             ]
         ];
 
-        $this->pageRepo->versioningPreview = true;
+        $this->pageRepo->versioningWorkspaceId = 13;
         $this->pageRepo->init(false);
 
         $conditions = $this->pageRepo->enableFields($table);
@@ -491,7 +471,6 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
             ]
         ];
 
-        $this->pageRepo->versioningPreview = true;
         $this->pageRepo->versioningWorkspaceId = 2;
         $this->pageRepo->init(false);
 
@@ -517,7 +496,7 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
             ]
         ];
 
-        $this->pageRepo->versioningPreview = true;
+        $this->pageRepo->versioningWorkspaceId = 23;
         $this->pageRepo->init(false);
 
         $conditions = $this->pageRepo->enableFields($table, -1, [], true);
@@ -531,7 +510,7 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
         $this->assertThat(
             $conditions,
             $this->logicalNot($this->stringContains(' AND (' . $connection->quoteIdentifier($table . '.pid') . ' <> -1)')),
-            'No necords from page -1'
+            'No records from page -1'
         );
     }
 
index 5404f93..b1a32f5 100644 (file)
@@ -396,4 +396,9 @@ return [
             'Deprecation-85122-FunctionalityInCharsetConverter.rst'
         ],
     ],
+    'TYPO3\CMS\Frontend\Page\PageRepository->versioningPreview' => [
+        'restFiles' => [
+            'Deprecation-85078-PageRepositoryVersioningPreview.rst',
+        ],
+    ],
 ];