19 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
34 protected function setUp()
37 $this->setUpBackendUserFromFixture(1);
39 $this->importDataSet(__DIR__ .
'/../Fixtures/sys_workspace.xml');
47 $this->markTestSkipped(
'This test need a review. It is green even if all fixtures are commented out');
49 $result = $service->selectVersionsInWorkspace(90);
50 $this->assertEmpty($result,
'The workspace 90 contains no changes and the result was supposed to be empty');
51 $this->assertTrue(is_array($result),
'Even the empty result from workspace 90 is supposed to be an array');
59 $this->importDataSet(
'PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/pages.xml');
60 $this->importDataSet(__DIR__ .
'/../Fixtures/pages.xml');
62 $result = $service->selectVersionsInWorkspace(91, 0, -99, 2);
63 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
67 'The result is supposed to contain one version for this page in workspace 91'
69 $this->assertEquals(102, $result[
'pages'][0][
'uid'],
'Wrong workspace overlay record picked');
70 $this->assertEquals(1, $result[
'pages'][0][
'livepid'],
'Real pid wasn\'t resolved correctly');
78 $this->importDataSet(
'PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/pages.xml');
79 $this->importDataSet(__DIR__ .
'/../Fixtures/pages.xml');
82 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
86 'The result is supposed to contain one version for this page in workspace 91'
95 $this->importDataSet(
'PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/pages.xml');
96 $this->importDataSet(__DIR__ .
'/../Fixtures/pages.xml');
98 $result = $service->selectVersionsInWorkspace(91, 0, -99, 1, 99);
99 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
103 'The result is supposed to contain four versions for this page in workspace 91'
112 $this->importDataSet(
'PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/pages.xml');
113 $this->importDataSet(__DIR__ .
'/../Fixtures/pages.xml');
116 $result = $service->selectVersionsInWorkspace(91, 0, 1, 1, 99);
117 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
121 'The result is supposed to contain two versions for this page in workspace 91'
123 $this->assertEquals(102, $result[
'pages'][0][
'uid'],
'First records is supposed to have the uid 102');
124 $this->assertEquals(105, $result[
'pages'][1][
'uid'],
'First records is supposed to have the uid 105');
126 $result = $service->selectVersionsInWorkspace(91, 0, 2, 1, 99);
127 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
131 'The result is supposed to contain two versions for this page in workspace 91'
133 $this->assertEquals(104, $result[
'pages'][0][
'uid'],
'First records is supposed to have the uid 106');
134 $this->assertEquals(106, $result[
'pages'][1][
'uid'],
'First records is supposed to have the uid 106');
142 $this->importDataSet(
'PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/pages.xml');
143 $this->importDataSet(__DIR__ .
'/../Fixtures/pages.xml');
146 $result = $service->selectVersionsInWorkspace(91, 1, -99, 1, 99);
147 $this->assertTrue(is_array($result),
'The result from workspace 91 is supposed to be an array');
151 'The result is supposed to contain three versions for this page in workspace 91'
154 $result = $service->selectVersionsInWorkspace(91, 2, -99, 1, 99);
158 'The result is supposed to contain two versions for this page in workspace 91'
161 $result = $service->selectVersionsInWorkspace(91, 0, -99, 1, 99);
165 'The result is supposed to contain two versions for this page in workspace 91'
177 $this->markTestSkipped(
'This test need a review. It is green even if all fixtures are commented out');
178 $this->importDataSet(__DIR__ .
'/Fixtures/WorkspaceServiceTestMovedContent.xml');
181 $result = $service->selectVersionsInWorkspace(91, 0, -99, 2, 99);
185 'Changes should not show up in this branch of the tree within workspace 91'
189 $result[
'tt_content'],
190 'Changes should not show up in this branch of the tree within workspace 91'
199 $this->importDataSet(__DIR__ .
'/Fixtures/WorkspaceServiceTestMovedContent.xml');
202 $result = $service->selectVersionsInWorkspace(91, 0, -99, 5, 99);
203 $this->assertCount(1, $result[
'pages'],
'Wrong amount of page versions found within workspace 91');
204 $this->assertEquals(103, $result[
'pages'][0][
'uid'],
'Wrong move-to pointer found for page 3 in workspace 91');
205 $this->assertEquals(5, $result[
'pages'][0][
'wspid'],
'Wrong workspace-pointer found for page 3 in workspace 91');
206 $this->assertEquals(2, $result[
'pages'][0][
'livepid'],
'Wrong live-pointer found for page 3 in workspace 91');
207 $this->assertCount(1, $result[
'tt_content'],
'Wrong amount of tt_content versions found within workspace 91');
208 $this->assertEquals(106, $result[
'tt_content'][0][
'uid'],
'Wrong move-to pointer found for page 3 in workspace 91');
209 $this->assertEquals(7, $result[
'tt_content'][0][
'wspid'],
'Wrong workspace-pointer found for page 3 in workspace 91');
210 $this->assertEquals(2, $result[
'tt_content'][0][
'livepid'],
'Wrong live-pointer found for page 3 in workspace 91');
218 $this->importDataSet(__DIR__ .
'/Fixtures/WorkspaceServiceTestMovedContent.xml');
221 $result = $service->selectVersionsInWorkspace(91, 0, -99, 3, 99);
222 $this->assertCount(1, $result,
'Wrong amount of versions found within workspace 91');
223 $this->assertCount(1, $result[
'pages'],
'Wrong amount of page versions found within workspace 91');
224 $this->assertEquals(103, $result[
'pages'][0][
'uid'],
'Wrong move-to pointer found for page 3 in workspace 91');
232 $this->importDataSet(__DIR__ .
'/Fixtures/WorkspaceServiceTestMovedContent.xml');
234 $result = $workspaceService->getPagesWithVersionsInTable(91);
236 'sys_category' => [],
237 'sys_collection' => [],
238 'sys_file_collection' => [],
239 'sys_file_metadata' => [],
240 'sys_file_reference' => [],
241 'backend_layout' => [],
242 'sys_template' => [],
248 self::assertSame($expected, $result);
256 $this->importDataSet(__DIR__ .
'/Fixtures/WorkspaceServiceTestMovedContent.xml');
258 $result = $workspaceService->hasPageRecordVersions(91, 7);
259 self::assertTrue($result);
267 $this->importDataSet(__DIR__ .
'/Fixtures/WorkspaceServiceTestMovedContent.xml');
269 $result = $workspaceService->hasPageRecordVersions(91, 3);
270 self::assertFalse($result);