2 declare(strict_types = 1);
27 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
28 use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory;
29 use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter;
30 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
71 protected function setUp(): void
75 $this->backendUser = $this->setUpBackendUserFromFixture(1);
79 $this->backendUser = $this->setUpBackendUser(9);
80 $this->context = GeneralUtility::makeInstance(Context::class);
81 $this->context->setAspect(
'backend.user', GeneralUtility::makeInstance(UserAspect::class, $this->backendUser));
83 $this->subject = $this->getAccessibleMock(TreeController::class, [
'dummy']);
88 unset($this->subject, $this->backendUser, $this->context);
95 $scenarioFile = __DIR__ .
'/Fixtures/PagesWithBEPermissions.yaml';
96 $factory = DataHandlerFactory::fromYamlFile($scenarioFile);
97 $writer = DataHandlerWriter::withBackendUser($this->backendUser);
98 $writer->invokeFactory($factory);
99 static::failIfArrayIsNotEmpty(
109 $actual = $this->subject->_call(
'getAllEntryPointPageTrees');
110 $keepProperties = array_flip([
'uid',
'title',
'_children']);
117 'title' =>
'ACME Inc',
121 'title' =>
'EN: Welcome',
127 'title' =>
'EN: Features',
131 'title' =>
'EN: Frontend Editing',
137 'title' =>
'EN: Managing content',
145 'title' =>
'EN: ACME in your Region',
149 'title' =>
'EN: Groups',
157 'title' =>
'Internal',
161 'title' =>
'Forecasts',
166 'title' =>
'Reports',
174 'title' =>
'Announcements & News',
180 'title' =>
'Page not found',
186 'title' =>
'Our Blog',
192 'title' =>
'Storage',
210 self::assertEquals($expected, $actual);
218 $actual = $this->subject->_call(
'getAllEntryPointPageTrees', 0,
'Groups');
219 $keepProperties = array_flip([
'uid',
'title',
'_children']);
226 'title' =>
'ACME Inc',
230 'title' =>
'EN: ACME in your Region',
234 'title' =>
'EN: Groups',
249 self::assertEquals($expected, $actual);
257 $actual = $this->subject->_call(
'getAllEntryPointPageTrees', 1200);
258 $keepProperties = array_flip([
'uid',
'title',
'_children']);
265 'title' =>
'EN: Features',
269 'title' =>
'EN: Frontend Editing',
275 'title' =>
'EN: Managing content',
282 self::assertEquals($expected, $actual);
290 $actual = $this->subject->_call(
'getAllEntryPointPageTrees', 1510);
291 $keepProperties = array_flip([
'uid',
'title',
'_children']);
296 self::assertEquals($expected, $actual);
304 $actual = $this->subject->_call(
'getAllEntryPointPageTrees', 7000);
305 $keepProperties = array_flip([
'uid',
'title',
'_children']);
310 self::assertEquals($expected, $actual);
319 $actual = $this->subject->_call(
'getAllEntryPointPageTrees');
320 $keepProperties = array_flip([
'uid',
'title',
'_children']);
327 'title' =>
'ACME Inc',
331 'title' =>
'EN: Goodbye',
335 'title' =>
'EN: Really Goodbye',
343 'title' =>
'EN: Welcome',
349 'title' =>
'EN: Features modified',
353 'title' =>
'EN: Managing data',
358 'title' =>
'EN: Managing content',
366 'title' =>
'Internal',
370 'title' =>
'Forecasts',
375 'title' =>
'Reports',
383 'title' =>
'Announcements & News',
396 'title' =>
'Products',
403 'title' =>
'Page not found',
409 'title' =>
'Our Blog',
415 'title' =>
'Storage',
428 self::assertEquals($expected, $actual);
434 'search for "ACME in your Region" (live value, but deleted in workspace)' => [
435 'ACME in your Region',
438 'search for non-existing value' => [
439 sha1(random_bytes(10)),
442 'search for "groups" (live value, but changed in workspace)' => [
446 'search for "teams" (workspace value)' => [
451 'title' =>
'EN: ACME in your Region',
455 'title' =>
'EN: Teams modified',
464 'search for "products" (moved from pid 1510 to pid 1700 in workspace)' => [
469 'title' =>
'Announcements & News',
473 'title' =>
'Products',
477 'title' =>
'Product 1',
500 $actual = $this->subject->_call(
'getAllEntryPointPageTrees', 0, $search);
501 $keepProperties = array_flip([
'uid',
'title',
'_children']);
508 'title' =>
'ACME Inc',
509 '_children' => $expectedChildren,
518 self::assertEquals($expected, $actual);
527 $actual = $this->subject->_call(
'getAllEntryPointPageTrees', 1200);
528 $keepProperties = array_flip([
'uid',
'title',
'_children']);
535 'title' =>
'EN: Features modified',
539 'title' =>
'EN: Managing data',
543 'title' =>
'EN: Managing complex data',
550 'title' =>
'EN: Managing content',
557 self::assertEquals($expected, $actual);
565 $this->backendUser->workspace = $workspaceId;
579 function (array $item) {
580 foreach ($item as $propertyName => $propertyValue) {
581 if (!is_array($propertyValue)) {
602 function (array $item) use ($keepProperties) {
604 $item = array_intersect_key($item, $keepProperties);
605 foreach ($item as $propertyName => $propertyValue) {
606 if (!is_array($propertyValue)) {