[FOLLOWUP][TASK] Streamline pages table in PageRepository 65/40665/2
authorBenjamin Mack <benni@typo3.org>
Fri, 26 Jun 2015 07:55:36 +0000 (09:55 +0200)
committerBenjamin Mack <benni@typo3.org>
Fri, 26 Jun 2015 08:03:55 +0000 (10:03 +0200)
Fix unit tests which require a valid TCA for pages now (as no
bootstrapping is done in Tests, also one test was failing before
as the expected SQL was negated.

Resolves: #65786
Releases: master
Change-Id: I93237f18cee42f86e2a7325cc859f2217bcf99ff
Reviewed-on: http://review.typo3.org/40665
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/frontend/Tests/Unit/Page/PageRepositoryTest.php

index fb6d305..1e7cf7d 100644 (file)
@@ -27,6 +27,25 @@ class PageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        protected $pageSelectObject;
 
+       protected $defaultTcaForPages = array(
+               'ctrl' => array(
+                       'label' => 'title',
+                       'tstamp' => 'tstamp',
+                       'sortby' => 'sorting',
+                       'type' => 'doktype',
+                       'versioningWS' => 2,
+                       'origUid' => 't3_origuid',
+                       'delete' => 'deleted',
+                       'enablecolumns' => array(
+                               'disabled' => 'hidden',
+                               'starttime' => 'starttime',
+                               'endtime' => 'endtime',
+                               'fe_group' => 'fe_group'
+                       ),
+               ),
+               'columns' => array()
+       );
+
        /**
         * Sets up this testcase
         */
@@ -178,6 +197,9 @@ class PageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function noPagesFromWorkspaceAreShownLive() {
                // initialization
                $wsid = 987654321;
+               $GLOBALS['TCA'] = array(
+                       'pages' => $this->defaultTcaForPages
+               );
 
                // simulate calls from \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->fetch_the_id()
                $this->pageSelectObject->versioningPreview = FALSE;
@@ -194,7 +216,7 @@ class PageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                $this->logicalNot(
                                        $this->stringContains('(pages.t3ver_wsid=0 or pages.t3ver_wsid=' . $wsid . ')')
                                ),
-                               $this->stringContains('AND NOT pages.t3ver_state>0')
+                               $this->stringContains('AND pages.t3ver_state<=0')
                        )
                );
 
@@ -208,6 +230,9 @@ class PageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function previewShowsPagesFromLiveAndCurrentWorkspace() {
                // initialization
                $wsid = 987654321;
+               $GLOBALS['TCA'] = array(
+                       'pages' => $this->defaultTcaForPages
+               );
 
                // simulate calls from \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->fetch_the_id()
                $this->pageSelectObject->versioningPreview = TRUE;
@@ -237,6 +262,7 @@ class PageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function enableFieldsHidesVersionedRecordsAndPlaceholders() {
                $table = $this->getUniqueId('aTable');
                $GLOBALS['TCA'] = array(
+                       'pages' => $this->defaultTcaForPages,
                        $table => array(
                                'ctrl' => array(
                                        'versioningWS' => 2
@@ -259,6 +285,7 @@ class PageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function enableFieldsDoesNotHidePlaceholdersInPreview() {
                $table = $this->getUniqueId('aTable');
                $GLOBALS['TCA'] = array(
+                       'pages' => $this->defaultTcaForPages,
                        $table => array(
                                'ctrl' => array(
                                        'versioningWS' => 2
@@ -281,6 +308,7 @@ class PageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function enableFieldsDoesFilterToCurrentAndLiveWorkspaceForRecordsInPreview() {
                $table = $this->getUniqueId('aTable');
                $GLOBALS['TCA'] = array(
+                       'pages' => $this->defaultTcaForPages,
                        $table => array(
                                'ctrl' => array(
                                        'versioningWS' => 2
@@ -303,6 +331,7 @@ class PageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function enableFieldsDoesNotHideVersionedRecordsWhenCheckingVersionOverlays() {
                $table = $this->getUniqueId('aTable');
                $GLOBALS['TCA'] = array(
+                       'pages' => $this->defaultTcaForPages,
                        $table => array(
                                'ctrl' => array(
                                        'versioningWS' => 2