[TASK] Fix functional tests in WorkspaceServiceTest 85/23185/8
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Sun, 18 Aug 2013 20:51:40 +0000 (22:51 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 27 Aug 2013 12:56:52 +0000 (14:56 +0200)
Refactor WorkspaceServiceTest to reflect recent changes
in functional testing.
Enable test so they will be run in Travis.
Still 2 tests are skipped and need further review,
but it can be done in the separate change.

Resolves: #51164
Releases: 6.2
Change-Id: I074629d877b6a4d336bd21aacd20268bf4746811
Reviewed-on: https://review.typo3.org/23185
Reviewed-by: Stefan Neufeind
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Tests/Functional/Fixtures/be_users.xml [new file with mode: 0644]
typo3/sysext/core/Tests/FunctionalTestCase.php
typo3/sysext/workspaces/Tests/Functional/Service/Fixtures/WorkspaceServiceTestMovedContent.xml [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/Service/Fixtures/dbMovedContent.xml [deleted file]
typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceServiceTest.php [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceTest.php [deleted file]

diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/be_users.xml b/typo3/sysext/core/Tests/Functional/Fixtures/be_users.xml
new file mode 100644 (file)
index 0000000..ac380cc
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<dataset>
+       <be_users>
+               <uid>1</uid>
+               <pid>0</pid>
+               <tstamp>1366642540</tstamp>
+               <username>admin</username>
+               <password>$1$tCrlLajZ$C0sikFQQ3SWaFAZ1Me0Z/1</password> <!-- password -->
+               <admin>1</admin>
+               <disable>0</disable>
+               <starttime>0</starttime>
+               <endtime>0</endtime>
+               <options>0</options>
+               <crdate>1366642540</crdate>
+               <cruser_id>0</cruser_id>
+               <fileoper_perms>0</fileoper_perms>
+               <workspace_perms>1</workspace_perms>
+               <disableIPlock>1</disableIPlock>
+               <deleted>0</deleted>
+               <TSconfig>NULL</TSconfig>
+               <lastlogin>1371033743</lastlogin>
+               <createdByAction>0</createdByAction>
+               <workspace_id>0</workspace_id>
+               <workspace_preview>1</workspace_preview>
+       </be_users>
+</dataset>
\ No newline at end of file
index 0a33d2b..a0379a5 100644 (file)
@@ -151,6 +151,37 @@ abstract class FunctionalTestCase extends BaseTestCase {
        }
 
        /**
+        * Initialize backend user
+        *
+        * @param int $userUid uid of the user we want to initialize. This user must exist in the fixture file
+        * @throws Exception
+        */
+       protected function setUpBackendUserFromFixture($userUid) {
+               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/be_users.xml');
+               $database = $this->getDatabase();
+               $userRow = $database->exec_SELECTgetSingleRow('*', 'be_users', 'uid = ' . $userUid);
+
+               /** @var $backendUser \TYPO3\CMS\Core\Authentication\BackendUserAuthentication */
+               $backendUser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
+               $sessionId = $backendUser->createSessionId();
+               $_SERVER['HTTP_COOKIE'] = 'be_typo_user=' . $sessionId . '; path=/';
+               $backendUser->id = $sessionId;
+               $backendUser->sendNoCacheHeaders = FALSE;
+               $backendUser->dontSetCookie = TRUE;
+               $backendUser->createUserSession($userRow);
+
+               $GLOBALS['BE_USER'] = $backendUser;
+               $GLOBALS['BE_USER']->start();
+               if (!is_array($GLOBALS['BE_USER']->user) || !$GLOBALS['BE_USER']->user['uid']) {
+                       throw new Exception(
+                               'Can not initialize backend user',
+                               1377095807
+                       );
+               }
+               $GLOBALS['BE_USER']->backendCheckLogin();
+       }
+
+       /**
         * Imports a data set represented as XML into the test database,
         *
         * @param string $path Absolute path to the XML file containing the data set to load
diff --git a/typo3/sysext/workspaces/Tests/Functional/Service/Fixtures/WorkspaceServiceTestMovedContent.xml b/typo3/sysext/workspaces/Tests/Functional/Service/Fixtures/WorkspaceServiceTestMovedContent.xml
new file mode 100644 (file)
index 0000000..ad2c46a
--- /dev/null
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<dataset>
+       <pages>
+               <uid>1</uid>
+               <pid>0</pid>
+               <title>Root</title>
+               <deleted>0</deleted>
+               <perms_everybody>15</perms_everybody>
+       </pages>
+       <pages>
+               <uid>2</uid>
+               <pid>1</pid>
+               <title>Dummy 1-2</title>
+               <deleted>0</deleted>
+               <perms_everybody>15</perms_everybody>
+       </pages>
+       <pages>
+               <uid>3</uid>
+               <pid>2</pid>
+               <title>Dummy 1-2-3 - to be moved</title>
+               <deleted>0</deleted>
+               <perms_everybody>15</perms_everybody>
+       </pages>
+       <pages>
+               <uid>4</uid>
+               <pid>3</pid>
+               <title>Dummy 1-2-3-4</title>
+               <deleted>0</deleted>
+               <perms_everybody>15</perms_everybody>
+       </pages>
+       <pages>
+               <uid>5</uid>
+               <pid>1</pid>
+               <title>Dummy 1-5</title>
+               <deleted>0</deleted>
+               <perms_everybody>15</perms_everybody>
+       </pages>
+       <pages>
+               <uid>6</uid>
+               <pid>5</pid>
+               <title>Dummy 1-5-6</title>
+               <deleted>0</deleted>
+               <perms_everybody>15</perms_everybody>
+       </pages>
+       <pages>
+               <uid>7</uid>
+               <pid>5</pid>
+               <title>Dummy 1-5-7</title>
+               <deleted>0</deleted>
+               <perms_everybody>15</perms_everybody>
+       </pages>
+
+       <pages>
+               <uid>103</uid>
+               <pid>-1</pid>
+               <title>Dummy 1-2-3 - "move from placeholder"</title>
+               <deleted>0</deleted>
+               <perms_everybody>15</perms_everybody>
+               <t3ver_oid>3</t3ver_oid>
+               <t3ver_wsid>91</t3ver_wsid>
+               <t3ver_state>4</t3ver_state>
+               <t3ver_stage>1</t3ver_stage>
+               <t3ver_move_id>0</t3ver_move_id>
+       </pages>
+       <pages>
+               <uid>203</uid>
+               <pid>5</pid>
+               <title>Dummy 1-2-3 - "move to placeholder"</title>
+               <deleted>0</deleted>
+               <perms_everybody>15</perms_everybody>
+               <t3ver_oid>0</t3ver_oid>
+               <t3ver_wsid>91</t3ver_wsid>
+               <t3ver_state>3</t3ver_state>
+               <t3ver_stage>0</t3ver_stage>
+               <t3ver_move_id>3</t3ver_move_id>
+       </pages>
+
+       <tt_content>
+               <uid>5</uid>
+               <pid>7</pid>
+               <header>Content - to be moved from page 7 to page 1</header>
+               <deleted>0</deleted>
+               <t3ver_oid>0</t3ver_oid>
+               <t3ver_wsid>0</t3ver_wsid>
+       </tt_content>
+
+       <tt_content>
+               <uid>105</uid>
+               <pid>-1</pid>
+               <header>Content - "move from placeholder"</header>
+               <deleted>0</deleted>
+               <t3ver_oid>5</t3ver_oid>
+               <t3ver_wsid>91</t3ver_wsid>
+               <t3ver_state>4</t3ver_state>
+               <t3ver_stage>1</t3ver_stage>
+               <t3ver_move_id>0</t3ver_move_id>
+       </tt_content>
+
+       <tt_content>
+               <uid>205</uid>
+               <pid>1</pid>
+               <header>Content - "move to placeholder"</header>
+               <deleted>0</deleted>
+               <t3ver_oid>0</t3ver_oid>
+               <t3ver_wsid>91</t3ver_wsid>
+               <t3ver_state>3</t3ver_state>
+               <t3ver_stage>0</t3ver_stage>
+               <t3ver_move_id>5</t3ver_move_id>
+       </tt_content>
+
+       <tt_content>
+               <uid>6</uid>
+               <pid>2</pid>
+               <header>Content - to be moved from page 2 to page 7</header>
+               <deleted>0</deleted>
+               <t3ver_oid>0</t3ver_oid>
+               <t3ver_wsid>0</t3ver_wsid>
+       </tt_content>
+
+       <tt_content>
+               <uid>106</uid>
+               <pid>-1</pid>
+               <header>Content - "move from placeholder"</header>
+               <deleted>0</deleted>
+               <t3ver_oid>6</t3ver_oid>
+               <t3ver_wsid>91</t3ver_wsid>
+               <t3ver_state>4</t3ver_state>
+               <t3ver_stage>1</t3ver_stage>
+               <t3ver_move_id>0</t3ver_move_id>
+       </tt_content>
+
+       <tt_content>
+               <uid>206</uid>
+               <pid>7</pid>
+               <header>Content - "move to placeholder"</header>
+               <deleted>0</deleted>
+               <t3ver_oid>0</t3ver_oid>
+               <t3ver_wsid>91</t3ver_wsid>
+               <t3ver_state>3</t3ver_state>
+               <t3ver_stage>0</t3ver_stage>
+               <t3ver_move_id>6</t3ver_move_id>
+       </tt_content>
+</dataset>
\ No newline at end of file
diff --git a/typo3/sysext/workspaces/Tests/Functional/Service/Fixtures/dbMovedContent.xml b/typo3/sysext/workspaces/Tests/Functional/Service/Fixtures/dbMovedContent.xml
deleted file mode 100644 (file)
index ad2c46a..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<dataset>
-       <pages>
-               <uid>1</uid>
-               <pid>0</pid>
-               <title>Root</title>
-               <deleted>0</deleted>
-               <perms_everybody>15</perms_everybody>
-       </pages>
-       <pages>
-               <uid>2</uid>
-               <pid>1</pid>
-               <title>Dummy 1-2</title>
-               <deleted>0</deleted>
-               <perms_everybody>15</perms_everybody>
-       </pages>
-       <pages>
-               <uid>3</uid>
-               <pid>2</pid>
-               <title>Dummy 1-2-3 - to be moved</title>
-               <deleted>0</deleted>
-               <perms_everybody>15</perms_everybody>
-       </pages>
-       <pages>
-               <uid>4</uid>
-               <pid>3</pid>
-               <title>Dummy 1-2-3-4</title>
-               <deleted>0</deleted>
-               <perms_everybody>15</perms_everybody>
-       </pages>
-       <pages>
-               <uid>5</uid>
-               <pid>1</pid>
-               <title>Dummy 1-5</title>
-               <deleted>0</deleted>
-               <perms_everybody>15</perms_everybody>
-       </pages>
-       <pages>
-               <uid>6</uid>
-               <pid>5</pid>
-               <title>Dummy 1-5-6</title>
-               <deleted>0</deleted>
-               <perms_everybody>15</perms_everybody>
-       </pages>
-       <pages>
-               <uid>7</uid>
-               <pid>5</pid>
-               <title>Dummy 1-5-7</title>
-               <deleted>0</deleted>
-               <perms_everybody>15</perms_everybody>
-       </pages>
-
-       <pages>
-               <uid>103</uid>
-               <pid>-1</pid>
-               <title>Dummy 1-2-3 - "move from placeholder"</title>
-               <deleted>0</deleted>
-               <perms_everybody>15</perms_everybody>
-               <t3ver_oid>3</t3ver_oid>
-               <t3ver_wsid>91</t3ver_wsid>
-               <t3ver_state>4</t3ver_state>
-               <t3ver_stage>1</t3ver_stage>
-               <t3ver_move_id>0</t3ver_move_id>
-       </pages>
-       <pages>
-               <uid>203</uid>
-               <pid>5</pid>
-               <title>Dummy 1-2-3 - "move to placeholder"</title>
-               <deleted>0</deleted>
-               <perms_everybody>15</perms_everybody>
-               <t3ver_oid>0</t3ver_oid>
-               <t3ver_wsid>91</t3ver_wsid>
-               <t3ver_state>3</t3ver_state>
-               <t3ver_stage>0</t3ver_stage>
-               <t3ver_move_id>3</t3ver_move_id>
-       </pages>
-
-       <tt_content>
-               <uid>5</uid>
-               <pid>7</pid>
-               <header>Content - to be moved from page 7 to page 1</header>
-               <deleted>0</deleted>
-               <t3ver_oid>0</t3ver_oid>
-               <t3ver_wsid>0</t3ver_wsid>
-       </tt_content>
-
-       <tt_content>
-               <uid>105</uid>
-               <pid>-1</pid>
-               <header>Content - "move from placeholder"</header>
-               <deleted>0</deleted>
-               <t3ver_oid>5</t3ver_oid>
-               <t3ver_wsid>91</t3ver_wsid>
-               <t3ver_state>4</t3ver_state>
-               <t3ver_stage>1</t3ver_stage>
-               <t3ver_move_id>0</t3ver_move_id>
-       </tt_content>
-
-       <tt_content>
-               <uid>205</uid>
-               <pid>1</pid>
-               <header>Content - "move to placeholder"</header>
-               <deleted>0</deleted>
-               <t3ver_oid>0</t3ver_oid>
-               <t3ver_wsid>91</t3ver_wsid>
-               <t3ver_state>3</t3ver_state>
-               <t3ver_stage>0</t3ver_stage>
-               <t3ver_move_id>5</t3ver_move_id>
-       </tt_content>
-
-       <tt_content>
-               <uid>6</uid>
-               <pid>2</pid>
-               <header>Content - to be moved from page 2 to page 7</header>
-               <deleted>0</deleted>
-               <t3ver_oid>0</t3ver_oid>
-               <t3ver_wsid>0</t3ver_wsid>
-       </tt_content>
-
-       <tt_content>
-               <uid>106</uid>
-               <pid>-1</pid>
-               <header>Content - "move from placeholder"</header>
-               <deleted>0</deleted>
-               <t3ver_oid>6</t3ver_oid>
-               <t3ver_wsid>91</t3ver_wsid>
-               <t3ver_state>4</t3ver_state>
-               <t3ver_stage>1</t3ver_stage>
-               <t3ver_move_id>0</t3ver_move_id>
-       </tt_content>
-
-       <tt_content>
-               <uid>206</uid>
-               <pid>7</pid>
-               <header>Content - "move to placeholder"</header>
-               <deleted>0</deleted>
-               <t3ver_oid>0</t3ver_oid>
-               <t3ver_wsid>91</t3ver_wsid>
-               <t3ver_state>3</t3ver_state>
-               <t3ver_stage>0</t3ver_stage>
-               <t3ver_move_id>6</t3ver_move_id>
-       </tt_content>
-</dataset>
\ No newline at end of file
diff --git a/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceServiceTest.php b/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceServiceTest.php
new file mode 100644 (file)
index 0000000..f03df2a
--- /dev/null
@@ -0,0 +1,187 @@
+<?php
+namespace TYPO3\CMS\Workspaces\Tests\Functional\Service;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2013 Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
+/**
+ * Workspace service test
+ *
+ * @author Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
+ */
+class WorkspacesServiceTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
+
+       protected $coreExtensionsToLoad = array('version', 'workspaces');
+
+       /**
+        * Set up
+        */
+       public function setUp() {
+               parent::setUp();
+               $this->setUpBackendUserFromFixture(1);
+               \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
+               $this->importDataSet(__DIR__ . '/../Fixtures/sys_workspace.xml');
+       }
+
+       /**
+        * @test
+        */
+       public function emptyWorkspaceReturnsEmptyArray() {
+               $this->markTestSkipped("This test need a review. It is green even if all fixtures are commented out");
+               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
+               $result = $service->selectVersionsInWorkspace(90);
+               $this->assertTrue(empty($result), 'The workspace 90 contains no changes and the result was supposed to be empty');
+               $this->assertTrue(is_array($result), 'Even the empty result from workspace 90 is supposed to be an array');
+       }
+
+       /**
+        * @test
+        */
+       public function versionsFromSpecificWorkspaceCanBeFound() {
+               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
+               $this->importDataSet(__DIR__ . '/../Fixtures/pages.xml');
+               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
+               $result = $service->selectVersionsInWorkspace(91, 0, -99, 2);
+               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
+               $this->assertEquals(1, sizeof($result['pages']), 'The result is supposed to contain one version for this page in workspace 91');
+               $this->assertEquals(102, $result['pages'][0]['uid'], 'Wrong workspace overlay record picked');
+               $this->assertEquals(1, $result['pages'][0]['livepid'], 'Real pid wasn\'t resolved correctly');
+       }
+
+       /**
+        * @test
+        */
+       public function versionsFromAllWorkspaceCanBeFound() {
+               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
+               $this->importDataSet(__DIR__ . '/../Fixtures/pages.xml');
+               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
+               $result = $service->selectVersionsInWorkspace(\TYPO3\CMS\Workspaces\Service\WorkspaceService::SELECT_ALL_WORKSPACES, 0, -99, 2);
+               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
+               $this->assertEquals(2, sizeof($result['pages']), 'The result is supposed to contain one version for this page in workspace 91');
+       }
+
+       /**
+        * @test
+        */
+       public function versionsCanBeFoundRecursive() {
+               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
+               $this->importDataSet(__DIR__ . '/../Fixtures/pages.xml');
+               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
+               $result = $service->selectVersionsInWorkspace(91, 0, -99, 1, 99);
+               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
+               $this->assertEquals(4, sizeof($result['pages']), 'The result is supposed to contain four versions for this page in workspace 91');
+       }
+
+       /**
+        * @test
+        */
+       public function versionsCanBeFilteredToSpecificStage() {
+               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
+               $this->importDataSet(__DIR__ . '/../Fixtures/pages.xml');
+               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
+               // testing stage 1
+               $result = $service->selectVersionsInWorkspace(91, 0, 1, 1, 99);
+               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
+               $this->assertEquals(2, sizeof($result['pages']), 'The result is supposed to contain two versions for this page in workspace 91');
+               $this->assertEquals(102, $result['pages'][0]['uid'], 'First records is supposed to have the uid 102');
+               $this->assertEquals(105, $result['pages'][1]['uid'], 'First records is supposed to have the uid 105');
+               // testing stage 2
+               $result = $service->selectVersionsInWorkspace(91, 0, 2, 1, 99);
+               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
+               $this->assertEquals(2, sizeof($result['pages']), 'The result is supposed to contain two versions for this page in workspace 91');
+               $this->assertEquals(104, $result['pages'][0]['uid'], 'First records is supposed to have the uid 106');
+               $this->assertEquals(106, $result['pages'][1]['uid'], 'First records is supposed to have the uid 106');
+       }
+
+       /**
+        * @test
+        */
+       public function versionsCanBeFilteredToSpecificLifecycleStep() {
+               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
+               $this->importDataSet(__DIR__ . '/../Fixtures/pages.xml');
+               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
+               // testing all "draft" records
+               $result = $service->selectVersionsInWorkspace(91, 1, -99, 1, 99);
+               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
+               $this->assertEquals(2, sizeof($result['pages']), 'The result is supposed to contain three versions for this page in workspace 91');
+               // testing all "archive" records
+               $result = $service->selectVersionsInWorkspace(91, 2, -99, 1, 99);
+               $this->assertEquals(2, sizeof($result['pages']), 'The result is supposed to contain two versions for this page in workspace 91');
+               // testing both types records
+               $result = $service->selectVersionsInWorkspace(91, 0, -99, 1, 99);
+               $this->assertEquals(4, sizeof($result['pages']), 'The result is supposed to contain two versions for this page in workspace 91');
+       }
+
+       /**
+        * The only change which we could find here actually moved away from this
+        * branch of the tree - therefore we're not supposed to find anything here
+        *
+        * @test
+        */
+       public function movedElementsCanNotBeFoundAtTheirOrigin() {
+               $this->markTestSkipped("This test need a review. It is green even if all fixtures are commented out");
+               $this->importDataSet(__DIR__ . '/Fixtures/WorkspaceServiceTestMovedContent.xml');
+               // Test if the placeholder can be found when we ask using recursion (same result)
+               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
+               $result = $service->selectVersionsInWorkspace(91, 0, -99, 2, 99);
+               $this->assertEquals(0, sizeof($result['pages']), 'Changes should not show up in this branch of the tree within workspace 91');
+               $this->assertEquals(0, sizeof($result['tt_content']), 'Changes should not show up in this branch of the tree within workspace 91');
+       }
+
+       /**
+        * @test
+        */
+       public function movedElementsCanBeFoundAtTheirDestination() {
+               $this->importDataSet(__DIR__ . '/Fixtures/WorkspaceServiceTestMovedContent.xml');
+               // Test if the placeholder can be found when we ask using recursion (same result)
+               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
+               $result = $service->selectVersionsInWorkspace(91, 0, -99, 5, 99);
+               $this->assertEquals(1, sizeof($result['pages']), 'Wrong amount of page versions found within workspace 91');
+               $this->assertEquals(103, $result['pages'][0]['uid'], 'Wrong move-to pointer found for page 3 in workspace 91');
+               $this->assertEquals(5, $result['pages'][0]['wspid'], 'Wrong workspace-pointer found for page 3 in workspace 91');
+               $this->assertEquals(2, $result['pages'][0]['livepid'], 'Wrong live-pointer found for page 3 in workspace 91');
+               $this->assertEquals(1, sizeof($result['tt_content']), 'Wrong amount of tt_content versions found within workspace 91');
+               $this->assertEquals(106, $result['tt_content'][0]['uid'], 'Wrong move-to pointer found for page 3 in workspace 91');
+               $this->assertEquals(7, $result['tt_content'][0]['wspid'], 'Wrong workspace-pointer found for page 3 in workspace 91');
+               $this->assertEquals(2, $result['tt_content'][0]['livepid'], 'Wrong live-pointer found for page 3 in workspace 91');
+       }
+
+       /**
+        * @test
+        */
+       public function movedElementsCanBeFoundUsingTheirLiveUid() {
+               $this->importDataSet(__DIR__ . '/Fixtures/WorkspaceServiceTestMovedContent.xml');
+               // Test if the placeholder can be found when we ask using recursion (same result)
+               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
+               $result = $service->selectVersionsInWorkspace(91, 0, -99, 3, 99);
+               $this->assertEquals(1, sizeof($result), 'Wrong amount of versions found within workspace 91');
+               $this->assertEquals(1, sizeof($result['pages']), 'Wrong amount of page versions found within workspace 91');
+               $this->assertEquals(103, $result['pages'][0]['uid'], 'Wrong move-to pointer found for page 3 in workspace 91');
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceTest.php b/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceTest.php
deleted file mode 100644 (file)
index 90b4f3f..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-<?php
-namespace TYPO3\CMS\Workspaces\Tests\Functional\Service;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/**
- * Workspace service test
- *
- * @author Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
- */
-class WorkspacesServiceTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
-
-       protected $coreExtensionsToLoad = array('version', 'workspaces');
-
-       /**
-        * Set up
-        */
-       public function setUp() {
-               $this->markTestIncomplete('needs to be fixed');
-               parent::setUp();
-               /** @var $backendUser \TYPO3\CMS\Core\Authentication\BackendUserAuthentication */
-               $backendUser = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
-               $backendUser->user['admin'] = 1;
-               $GLOBALS['BE_USER'] = $backendUser;
-               \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
-
-               $this->importDataSet(dirname(__FILE__) . '/Fixtures/dbDefaultWorkspaces.xml');
-       }
-
-       /**
-        * @test
-        */
-       public function emptyWorkspaceReturnsEmptyArray() {
-               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
-               $result = $service->selectVersionsInWorkspace(90);
-               $this->assertTrue(empty($result), 'The workspace 90 contains no changes and the result was supposed to be empty');
-               $this->assertTrue(is_array($result), 'Even the empty result from workspace 90 is supposed to be an array');
-       }
-
-       /**
-        * @test
-        */
-       public function versionsFromSpecificWorkspaceCanBeFound() {
-               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Functional/Fixtures/pages.xml');
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/dbDefaultPages.xml');
-               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
-               $result = $service->selectVersionsInWorkspace(91, 0, -99, 2);
-               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
-               $this->assertEquals(1, sizeof($result['pages']), 'The result is supposed to contain one version for this page in workspace 91');
-               $this->assertEquals(102, $result['pages'][0]['uid'], 'Wrong workspace overlay record picked');
-               $this->assertEquals(1, $result['pages'][0]['livepid'], 'Real pid wasn\'t resolved correctly');
-       }
-
-       /**
-        * @test
-        */
-       public function versionsFromAllWorkspaceCanBeFound() {
-               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Functional/Fixtures/pages.xml');
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/dbDefaultPages.xml');
-               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
-               $result = $service->selectVersionsInWorkspace(\TYPO3\CMS\Workspaces\Service\WorkspaceService::SELECT_ALL_WORKSPACES, 0, -99, 2);
-               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
-               $this->assertEquals(2, sizeof($result['pages']), 'The result is supposed to contain one version for this page in workspace 91');
-       }
-
-       /**
-        * @test
-        */
-       public function versionsCanBeFoundRecursive() {
-               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Functional/Fixtures/pages.xml');
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/dbDefaultPages.xml');
-               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
-               $result = $service->selectVersionsInWorkspace(91, 0, -99, 1, 99);
-               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
-               $this->assertEquals(4, sizeof($result['pages']), 'The result is supposed to contain four versions for this page in workspace 91');
-       }
-
-       /**
-        * @test
-        */
-       public function versionsCanBeFilteredToSpecificStage() {
-               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Functional/Fixtures/pages.xml');
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/dbDefaultPages.xml');
-               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
-               // testing stage 1
-               $result = $service->selectVersionsInWorkspace(91, 0, 1, 1, 99);
-               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
-               $this->assertEquals(2, sizeof($result['pages']), 'The result is supposed to contain two versions for this page in workspace 91');
-               $this->assertEquals(102, $result['pages'][0]['uid'], 'First records is supposed to have the uid 102');
-               $this->assertEquals(105, $result['pages'][1]['uid'], 'First records is supposed to have the uid 105');
-               // testing stage 2
-               $result = $service->selectVersionsInWorkspace(91, 0, 2, 1, 99);
-               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
-               $this->assertEquals(2, sizeof($result['pages']), 'The result is supposed to contain two versions for this page in workspace 91');
-               $this->assertEquals(104, $result['pages'][0]['uid'], 'First records is supposed to have the uid 106');
-               $this->assertEquals(106, $result['pages'][1]['uid'], 'First records is supposed to have the uid 106');
-       }
-
-       /**
-        * @test
-        */
-       public function versionsCanBeFilteredToSpecificLifecycleStep() {
-               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Functional/Fixtures/pages.xml');
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/dbDefaultPages.xml');
-               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
-               // testing all "draft" records
-               $result = $service->selectVersionsInWorkspace(91, 1, -99, 1, 99);
-               $this->assertTrue(is_array($result), 'The result from workspace 91 is supposed to be an array');
-               $this->assertEquals(2, sizeof($result['pages']), 'The result is supposed to contain three versions for this page in workspace 91');
-               // testing all "archive" records
-               $result = $service->selectVersionsInWorkspace(91, 2, -99, 1, 99);
-               $this->assertEquals(2, sizeof($result['pages']), 'The result is supposed to contain two versions for this page in workspace 91');
-               // testing both types records
-               $result = $service->selectVersionsInWorkspace(91, 0, -99, 1, 99);
-               $this->assertEquals(4, sizeof($result['pages']), 'The result is supposed to contain two versions for this page in workspace 91');
-       }
-
-       /**
-        * The only change which we could find here actually moved away from this
-        * branch of the tree - therefore we're not supposed to find anything here
-        *
-        * @test
-        */
-       public function movedElementsCanNotBeFoundAtTheirOrigin() {
-               $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Functional/Fixtures/pages.xml');
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/dbMovedContent.xml');
-               // Test if the placeholder can be found when we ask using recursion (same result)
-               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
-               $result = $service->selectVersionsInWorkspace(91, 0, -99, 2, 99);
-               $this->assertEquals(0, sizeof($result['pages']), 'Changes should not show up in this branch of the tree within workspace 91');
-               $this->assertEquals(0, sizeof($result['tt_content']), 'Changes should not show up in this branch of the tree within workspace 91');
-       }
-
-       /**
-        * @test
-        */
-       public function movedElementsCanBeFoundAtTheirDestination() {
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/dbMovedContent.xml');
-               // Test if the placeholder can be found when we ask using recursion (same result)
-               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
-               $result = $service->selectVersionsInWorkspace(91, 0, -99, 5, 99);
-               $this->assertEquals(1, sizeof($result['pages']), 'Wrong amount of page versions found within workspace 91');
-               $this->assertEquals(103, $result['pages'][0]['uid'], 'Wrong move-to pointer found for page 3 in workspace 91');
-               $this->assertEquals(5, $result['pages'][0]['wspid'], 'Wrong workspace-pointer found for page 3 in workspace 91');
-               $this->assertEquals(2, $result['pages'][0]['livepid'], 'Wrong live-pointer found for page 3 in workspace 91');
-               $this->assertEquals(1, sizeof($result['tt_content']), 'Wrong amount of tt_content versions found within workspace 91');
-               $this->assertEquals(106, $result['tt_content'][0]['uid'], 'Wrong move-to pointer found for page 3 in workspace 91');
-               $this->assertEquals(7, $result['tt_content'][0]['wspid'], 'Wrong workspace-pointer found for page 3 in workspace 91');
-               $this->assertEquals(2, $result['tt_content'][0]['livepid'], 'Wrong live-pointer found for page 3 in workspace 91');
-       }
-
-       /**
-        * @test
-        */
-       public function movedElementsCanBeFoundUsingTheirLiveUID() {
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/dbMovedContent.xml');
-               // Test if the placeholder can be found when we ask using recursion (same result)
-               $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
-               $result = $service->selectVersionsInWorkspace(91, 0, -99, 3, 99);
-               $this->assertEquals(1, sizeof($result), 'Wrong amount of versions found within workspace 91');
-               $this->assertEquals(1, sizeof($result['pages']), 'Wrong amount of page versions found within workspace 91');
-               $this->assertEquals(103, $result['pages'][0]['uid'], 'Wrong move-to pointer found for page 3 in workspace 91');
-       }
-}
-?>
\ No newline at end of file