2 namespace TYPO3\CMS\Workspaces\Tests\Functional\Service;
30 $this->setUpBackendUserFromFixture(1);
31 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
32 $this->importDataSet(__DIR__ .
'/../Fixtures/sys_workspace.xml');
40 $this->markTestSkipped(
"This test need a review. It is green even if all fixtures are commented out");
41 $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
42 $result = $service->selectVersionsInWorkspace(90);
43 $this->assertTrue(empty($result),
'The workspace 90 contains no changes and the result was supposed to be empty');
44 $this->assertTrue(is_array($result),
'Even the empty result from workspace 90 is supposed to be an array');
52 $this->importDataSet(ORIGINAL_ROOT .
'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
53 $this->importDataSet(__DIR__ .
'/../Fixtures/pages.xml');
54 $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
55 $result = $service->selectVersionsInWorkspace(91, 0, -99, 2);
56 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
57 $this->assertEquals(1,
sizeof($result[
'pages']),
'The result is supposed to contain one version for this page in workspace 91');
58 $this->assertEquals(102, $result[
'pages'][0][
'uid'],
'Wrong workspace overlay record picked');
59 $this->assertEquals(1, $result[
'pages'][0][
'livepid'],
'Real pid wasn\'t resolved correctly');
67 $this->importDataSet(ORIGINAL_ROOT .
'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
68 $this->importDataSet(__DIR__ .
'/../Fixtures/pages.xml');
69 $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
70 $result = $service->selectVersionsInWorkspace(\TYPO3\CMS\Workspaces\Service\WorkspaceService::SELECT_ALL_WORKSPACES, 0, -99, 2);
71 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
72 $this->assertEquals(2,
sizeof($result[
'pages']),
'The result is supposed to contain one version for this page in workspace 91');
80 $this->importDataSet(ORIGINAL_ROOT .
'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
81 $this->importDataSet(__DIR__ .
'/../Fixtures/pages.xml');
82 $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
83 $result = $service->selectVersionsInWorkspace(91, 0, -99, 1, 99);
84 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
85 $this->assertEquals(4,
sizeof($result[
'pages']),
'The result is supposed to contain four versions for this page in workspace 91');
93 $this->importDataSet(ORIGINAL_ROOT .
'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
94 $this->importDataSet(__DIR__ .
'/../Fixtures/pages.xml');
95 $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
97 $result = $service->selectVersionsInWorkspace(91, 0, 1, 1, 99);
98 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
99 $this->assertEquals(2,
sizeof($result[
'pages']),
'The result is supposed to contain two versions for this page in workspace 91');
100 $this->assertEquals(102, $result[
'pages'][0][
'uid'],
'First records is supposed to have the uid 102');
101 $this->assertEquals(105, $result[
'pages'][1][
'uid'],
'First records is supposed to have the uid 105');
103 $result = $service->selectVersionsInWorkspace(91, 0, 2, 1, 99);
104 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
105 $this->assertEquals(2,
sizeof($result[
'pages']),
'The result is supposed to contain two versions for this page in workspace 91');
106 $this->assertEquals(104, $result[
'pages'][0][
'uid'],
'First records is supposed to have the uid 106');
107 $this->assertEquals(106, $result[
'pages'][1][
'uid'],
'First records is supposed to have the uid 106');
115 $this->importDataSet(ORIGINAL_ROOT .
'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
116 $this->importDataSet(__DIR__ .
'/../Fixtures/pages.xml');
117 $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
119 $result = $service->selectVersionsInWorkspace(91, 1, -99, 1, 99);
120 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
121 $this->assertEquals(2,
sizeof($result[
'pages']),
'The result is supposed to contain three versions for this page in workspace 91');
123 $result = $service->selectVersionsInWorkspace(91, 2, -99, 1, 99);
124 $this->assertEquals(2,
sizeof($result[
'pages']),
'The result is supposed to contain two versions for this page in workspace 91');
126 $result = $service->selectVersionsInWorkspace(91, 0, -99, 1, 99);
127 $this->assertEquals(4,
sizeof($result[
'pages']),
'The result is supposed to contain two versions for this page in workspace 91');
138 $this->markTestSkipped(
"This test need a review. It is green even if all fixtures are commented out");
139 $this->importDataSet(__DIR__ .
'/Fixtures/WorkspaceServiceTestMovedContent.xml');
141 $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
142 $result = $service->selectVersionsInWorkspace(91, 0, -99, 2, 99);
143 $this->assertEquals(0,
sizeof($result[
'pages']),
'Changes should not show up in this branch of the tree within workspace 91');
144 $this->assertEquals(0,
sizeof($result[
'tt_content']),
'Changes should not show up in this branch of the tree within workspace 91');
152 $this->importDataSet(__DIR__ .
'/Fixtures/WorkspaceServiceTestMovedContent.xml');
154 $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
155 $result = $service->selectVersionsInWorkspace(91, 0, -99, 5, 99);
156 $this->assertEquals(1,
sizeof($result[
'pages']),
'Wrong amount of page versions found within workspace 91');
157 $this->assertEquals(103, $result[
'pages'][0][
'uid'],
'Wrong move-to pointer found for page 3 in workspace 91');
158 $this->assertEquals(5, $result[
'pages'][0][
'wspid'],
'Wrong workspace-pointer found for page 3 in workspace 91');
159 $this->assertEquals(2, $result[
'pages'][0][
'livepid'],
'Wrong live-pointer found for page 3 in workspace 91');
160 $this->assertEquals(1,
sizeof($result[
'tt_content']),
'Wrong amount of tt_content versions found within workspace 91');
161 $this->assertEquals(106, $result[
'tt_content'][0][
'uid'],
'Wrong move-to pointer found for page 3 in workspace 91');
162 $this->assertEquals(7, $result[
'tt_content'][0][
'wspid'],
'Wrong workspace-pointer found for page 3 in workspace 91');
163 $this->assertEquals(2, $result[
'tt_content'][0][
'livepid'],
'Wrong live-pointer found for page 3 in workspace 91');
171 $this->importDataSet(__DIR__ .
'/Fixtures/WorkspaceServiceTestMovedContent.xml');
173 $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();
174 $result = $service->selectVersionsInWorkspace(91, 0, -99, 3, 99);
175 $this->assertEquals(1,
sizeof($result),
'Wrong amount of versions found within workspace 91');
176 $this->assertEquals(1,
sizeof($result[
'pages']),
'Wrong amount of page versions found within workspace 91');
177 $this->assertEquals(103, $result[
'pages'][0][
'uid'],
'Wrong move-to pointer found for page 3 in workspace 91');