‪TYPO3CMS  ‪main
PageRepositoryTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use PHPUnit\Framework\Attributes\DataProvider;
21 use PHPUnit\Framework\Attributes\Test;
22 use Symfony\Component\DependencyInjection\Container;
35 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
36 
37 final class ‪PageRepositoryTest extends FunctionalTestCase
38 {
39  protected function ‪setUp(): void
40  {
41  parent::setUp();
42  $this->importCSVDataSet(__DIR__ . '/../../Fixtures/pages.csv');
43  }
44 
45  #[Test]
46  public function ‪getMenuSingleUidRoot(): void
47  {
48  $subject = new ‪PageRepository();
49  $rows = $subject->getMenu(1);
50  self::assertArrayHasKey(2, $rows);
51  self::assertArrayHasKey(3, $rows);
52  self::assertArrayHasKey(4, $rows);
53  self::assertCount(3, $rows);
54  }
55 
56  #[Test]
57  public function ‪getMenuSingleUidSubpage(): void
58  {
59  $subject = new ‪PageRepository();
60  $rows = $subject->getMenu(2);
61  self::assertArrayHasKey(5, $rows);
62  self::assertArrayHasKey(7, $rows);
63  self::assertCount(2, $rows);
64  }
65 
66  #[Test]
67  public function ‪getMenuMultipleUid(): void
68  {
69  $subject = new ‪PageRepository();
70  $rows = $subject->getMenu([2, 3]);
71  self::assertArrayHasKey(5, $rows);
72  self::assertArrayHasKey(7, $rows);
73  self::assertArrayHasKey(8, $rows);
74  self::assertArrayHasKey(9, $rows);
75  self::assertCount(4, $rows);
76  }
77 
78  #[Test]
79  public function ‪getMenuPageOverlay(): void
80  {
81  $context = new ‪Context();
82  $context->setAspect('language', new ‪LanguageAspect(1));
83  $subject = new ‪PageRepository($context);
84  $rows = $subject->getMenu([2, 3]);
85  self::assertEquals('Attrappe 1-2-5', $rows[5]['title']);
86  self::assertEquals('Dummy 1-2-7', $rows[7]['title']);
87  self::assertEquals('Dummy 1-3-8', $rows[8]['title']);
88  self::assertEquals('Attrappe 1-3-9', $rows[9]['title']);
89  self::assertCount(4, $rows);
90  }
91 
92  #[Test]
93  public function ‪getMenuWithMountPoint(): void
94  {
95  $subject = new ‪PageRepository();
96  $rows = $subject->getMenu([1000]);
97  self::assertEquals('root default language', $rows[1003]['title']);
98  self::assertEquals('1001', $rows[1003]['uid']);
99  self::assertEquals('1001-1003', $rows[1003]['_MP_PARAM']);
100  self::assertCount(2, $rows);
101  }
102 
103  #[Test]
104  public function ‪getMenuPageOverlayWithMountPoint(): void
105  {
106  $context = new ‪Context();
107  $context->setAspect('language', new ‪LanguageAspect(1));
108  $subject = new ‪PageRepository($context);
109  $rows = $subject->getMenu([1000]);
110  self::assertEquals('root translation', $rows[1003]['title']);
111  self::assertEquals('1001', $rows[1003]['uid']);
112  self::assertEquals('1002', $rows[1003]['_LOCALIZED_UID']);
113  self::assertEquals('1001-1003', $rows[1003]['_MP_PARAM']);
114  self::assertCount(2, $rows);
115  }
116 
117  #[Test]
118  public function ‪getPageOverlayById(): void
119  {
120  $subject = new ‪PageRepository();
121  $row = $subject->getPageOverlay(1, 1);
122  $this->‪assertOverlayRow($row);
123  self::assertEquals('Wurzel 1', $row['title']);
124  self::assertEquals('901', $row['_LOCALIZED_UID']);
125  self::assertEquals(1, $row['sys_language_uid']);
126  }
127 
128  #[Test]
130  {
131  $subject = new ‪PageRepository();
132  $row = $subject->getPageOverlay(4, 1);
133  self::assertIsArray($row);
134  self::assertCount(0, $row);
135  }
136 
137  #[Test]
138  public function ‪getPageOverlayByRow(): void
139  {
140  $subject = new ‪PageRepository();
141  $orig = $subject->getPage(1);
142  $row = $subject->getPageOverlay($orig, 1);
143  $this->‪assertOverlayRow($row);
144  self::assertEquals(1, $row['uid']);
145  self::assertEquals('Wurzel 1', $row['title']);
146  self::assertEquals('901', $row['_LOCALIZED_UID']);
147  self::assertEquals(1, $row['sys_language_uid']);
148  }
149 
150  #[Test]
152  {
153  $subject = new ‪PageRepository();
154  $orig = $subject->getPage(4);
155  $row = $subject->getPageOverlay($orig, 1);
156  self::assertIsArray($row);
157  self::assertEquals(4, $row['uid']);
158  self::assertEquals('Dummy 1-4', $row['title']);//original title
159  }
160 
161  #[Test]
162  public function ‪getPagesOverlayByIdSingle(): void
163  {
164  $context = new ‪Context();
165  $context->setAspect('language', new ‪LanguageAspect(1));
166  $subject = new ‪PageRepository($context);
167  $rows = $subject->getPagesOverlay([1]);
168  self::assertIsArray($rows);
169  self::assertCount(1, $rows);
170  self::assertArrayHasKey(0, $rows);
171 
172  $row = $rows[0];
173  $this->‪assertOverlayRow($row);
174  self::assertEquals('Wurzel 1', $row['title']);
175  self::assertEquals('901', $row['_LOCALIZED_UID']);
176  self::assertEquals(1, $row['sys_language_uid']);
177  }
178 
179  #[Test]
180  public function ‪getPagesOverlayByIdMultiple(): void
181  {
182  $context = new ‪Context();
183  $context->setAspect('language', new ‪LanguageAspect(1));
184  $subject = new ‪PageRepository($context);
185  $rows = $subject->getPagesOverlay([1, 5, 15]);
186  self::assertIsArray($rows);
187  self::assertCount(2, $rows);
188  self::assertArrayHasKey(0, $rows);
189  self::assertArrayHasKey(1, $rows);
190 
191  $row = $rows[0];
192  $this->‪assertOverlayRow($row);
193  self::assertEquals('Wurzel 1', $row['title']);
194  self::assertEquals('901', $row['_LOCALIZED_UID']);
195  self::assertEquals(1, $row['sys_language_uid']);
196 
197  $row = $rows[1];
198  $this->‪assertOverlayRow($row);
199  self::assertEquals('Attrappe 1-2-5', $row['title']);
200  self::assertEquals('904', $row['_LOCALIZED_UID']);
201  self::assertEquals(1, $row['sys_language_uid']);
202  }
203 
204  #[Test]
206  {
207  $context = new ‪Context();
208  $context->setAspect('language', new ‪LanguageAspect(1));
209  $subject = new ‪PageRepository($context);
210  $rows = $subject->getPagesOverlay([1, 4, 5, 8]);
211  self::assertIsArray($rows);
212  self::assertCount(2, $rows);
213  self::assertArrayHasKey(0, $rows);
214  self::assertArrayHasKey(2, $rows);
215 
216  $row = $rows[0];
217  $this->‪assertOverlayRow($row);
218  self::assertEquals('Wurzel 1', $row['title']);
219 
220  $row = $rows[2];
221  $this->‪assertOverlayRow($row);
222  self::assertEquals('Attrappe 1-2-5', $row['title']);
223  }
224 
225  #[Test]
226  public function ‪getPagesOverlayByRowSingle(): void
227  {
228  $subject = new ‪PageRepository();
229  $origRow = $subject->getPage(1);
230 
231  $context = new ‪Context();
232  $context->setAspect('language', new ‪LanguageAspect(1));
233  $subject = new ‪PageRepository($context);
234  $rows = $subject->getPagesOverlay([$origRow]);
235  self::assertIsArray($rows);
236  self::assertCount(1, $rows);
237  self::assertArrayHasKey(0, $rows);
238 
239  $row = $rows[0];
240  $this->‪assertOverlayRow($row);
241  self::assertEquals('Wurzel 1', $row['title']);
242  self::assertEquals('901', $row['_LOCALIZED_UID']);
243  self::assertEquals(1, $row['sys_language_uid']);
244  self::assertEquals(new ‪Page($origRow), $row['_TRANSLATION_SOURCE']);
245  }
246 
247  #[Test]
248  public function ‪groupRestrictedPageCanBeOverlaid(): void
249  {
250  $subject = new ‪PageRepository();
251  $origRow = $subject->getPage(6, true);
252 
253  $context = new ‪Context();
254  $context->setAspect('language', new ‪LanguageAspect(1));
255  $subject = new ‪PageRepository($context);
256  $rows = $subject->getPagesOverlay([$origRow]);
257  self::assertIsArray($rows);
258  self::assertCount(1, $rows);
259  self::assertArrayHasKey(0, $rows);
260 
261  $row = $rows[0];
262  $this->‪assertOverlayRow($row);
263  self::assertEquals('Attrappe 1-2-6', $row['title']);
264  self::assertEquals('905', $row['_LOCALIZED_UID']);
265  self::assertEquals(1, $row['sys_language_uid']);
266  }
267 
268  #[Test]
269  public function ‪getPagesOverlayByRowMultiple(): void
270  {
271  $subject = new ‪PageRepository();
272  $orig1 = $subject->getPage(1);
273  $orig2 = $subject->getPage(5);
274 
275  $context = new ‪Context();
276  $context->setAspect('language', new ‪LanguageAspect(1));
277  $subject = new ‪PageRepository($context);
278  $rows = $subject->getPagesOverlay([1 => $orig1, 5 => $orig2]);
279  self::assertIsArray($rows);
280  self::assertCount(2, $rows);
281  self::assertArrayHasKey(1, $rows);
282  self::assertArrayHasKey(5, $rows);
283 
284  $row = $rows[1];
285  $this->‪assertOverlayRow($row);
286  self::assertEquals('Wurzel 1', $row['title']);
287  self::assertEquals('901', $row['_LOCALIZED_UID']);
288  self::assertEquals(1, $row['sys_language_uid']);
289  self::assertEquals(new ‪Page($orig1), $row['_TRANSLATION_SOURCE']);
290 
291  $row = $rows[5];
292  $this->‪assertOverlayRow($row);
293  self::assertEquals('Attrappe 1-2-5', $row['title']);
294  self::assertEquals('904', $row['_LOCALIZED_UID']);
295  self::assertEquals(1, $row['sys_language_uid']);
296  self::assertEquals(new ‪Page($orig2), $row['_TRANSLATION_SOURCE']);
297  }
298 
299  #[Test]
301  {
302  $subject = new ‪PageRepository();
303  $orig1 = $subject->getPage(1);
304  $orig2 = $subject->getPage(7);
305  $orig3 = $subject->getPage(9);
306 
307  $context = new ‪Context();
308  $context->setAspect('language', new ‪LanguageAspect(1));
309  $subject = new ‪PageRepository($context);
310  $rows = $subject->getPagesOverlay([$orig1, $orig2, $orig3]);
311  self::assertIsArray($rows);
312  self::assertCount(3, $rows);
313  self::assertArrayHasKey(0, $rows);
314  self::assertArrayHasKey(1, $rows);
315  self::assertArrayHasKey(2, $rows);
316 
317  $row = $rows[0];
318  $this->‪assertOverlayRow($row);
319  self::assertEquals('Wurzel 1', $row['title']);
320  self::assertEquals(new ‪Page($orig1), $row['_TRANSLATION_SOURCE']);
321 
322  $row = $rows[1];
323  $this->‪assertNotOverlayRow($row);
324  self::assertEquals('Dummy 1-2-7', $row['title']);
325  self::assertFalse(isset($row['_TRANSLATION_SOURCE']));
326 
327  $row = $rows[2];
328  $this->‪assertOverlayRow($row);
329  self::assertEquals('Attrappe 1-3-9', $row['title']);
330  self::assertEquals(new ‪Page($orig3), $row['_TRANSLATION_SOURCE']);
331  }
332 
334  // Tests concerning mountpoints
337  #[Test]
339  {
340  $subject = new ‪PageRepository();
341  $mountPointInfo = $subject->getMountPointInfo(1003);
342  self::assertEquals('1001-1003', $mountPointInfo['MPvar']);
343  }
344 
345  #[Test]
346  public function ‪getMountPointInfoForTranslation(): void
347  {
348  $mpVar = '1001-1003';
349  $context = new ‪Context();
350  $context->setAspect('language', new ‪LanguageAspect(1));
351  $subject = new ‪PageRepository($context);
352  $mountPointInfo = $subject->getMountPointInfo(1003);
353  self::assertEquals($mpVar, $mountPointInfo['MPvar']);
354 
355  $mountPointInfo = $subject->getMountPointInfo(1004);
356  self::assertEquals($mpVar, $mountPointInfo['MPvar']);
357  }
358 
360  // Tests concerning workspaces
362  #[Test]
364  {
365  $wsid = 987654321;
366  $context = new ‪Context();
367  $context->setAspect('workspace', new ‪WorkspaceAspect($wsid));
368  $subject = new ‪PageRepository($context);
369  $pageRec = $subject->getPage(11);
370 
371  self::assertEquals(11, $pageRec['uid']);
372  self::assertEquals(0, $pageRec['t3ver_oid']);
373  self::assertEquals(987654321, $pageRec['t3ver_wsid']);
374  self::assertEquals(VersionState::NEW_PLACEHOLDER->value, $pageRec['t3ver_state']);
375  }
376 
377  #[Test]
379  {
380  $wsid = 987654321;
381  $context = new ‪Context();
382  $context->setAspect('workspace', new ‪WorkspaceAspect($wsid));
383  $subject = new ‪PageRepository($context);
384 
385  $pageRec = $subject->getWorkspaceVersionOfRecord('pages', 11);
386 
387  self::assertEquals(11, $pageRec['uid']);
388  self::assertEquals(0, $pageRec['t3ver_oid']);
389  self::assertEquals($wsid, $pageRec['t3ver_wsid']);
390  self::assertEquals(VersionState::NEW_PLACEHOLDER->value, $pageRec['t3ver_state']);
391  }
392 
394  // Tests concerning versioning
396  #[Test]
398  {
399  $table = ‪StringUtility::getUniqueId('aTable');
400  ‪$GLOBALS['TCA'][$table] = [
401  'ctrl' => [
402  'versioningWS' => true,
403  ],
404  ];
405 
406  $subject = new ‪PageRepository(new ‪Context());
407 
408  $conditions = $subject->getDefaultConstraints($table);
409  $connection = $this->get(ConnectionPool::class)->getConnectionForTable($table);
410  $expr = $connection->getExpressionBuilder();
411 
412  self::assertThat(
413  (string)$expr->and(...$conditions),
414  self::stringContains('((((' . $connection->quoteIdentifier($table . '.t3ver_state') . ' <= 0)'),
415  'Versioning placeholders'
416  );
417  self::assertThat(
418  (string)$expr->and(...$conditions),
419  self::stringContains('(((' . $connection->quoteIdentifier($table . '.t3ver_oid') . ' = 0) OR (' . $connection->quoteIdentifier($table . '.t3ver_state') . ' = 4)))'),
420  'Records with online version'
421  );
422  }
423 
424  #[Test]
426  {
427  $table = ‪StringUtility::getUniqueId('aTable');
428  ‪$GLOBALS['TCA'][$table] = [
429  'ctrl' => [
430  'versioningWS' => true,
431  ],
432  ];
433 
434  $context = new ‪Context();
435  $context->setAspect('workspace', new ‪WorkspaceAspect(13));
436  $subject = new ‪PageRepository($context);
437 
438  $conditions = $subject->getDefaultConstraints($table);
439  $connection = $this->get(ConnectionPool::class)->getConnectionForTable($table);
440  $expr = $connection->getExpressionBuilder();
441 
442  self::assertThat(
443  (string)$expr->and(...$conditions),
444  self::logicalNot(self::stringContains('(' . $connection->quoteIdentifier($table . '.t3ver_state') . ' <= 0)')),
445  'No versioning placeholders'
446  );
447  self::assertThat(
448  (string)$expr->and(...$conditions),
449  self::stringContains(' AND (((' . $connection->quoteIdentifier($table . '.t3ver_oid') . ' = 0) OR (' . $connection->quoteIdentifier($table . '.t3ver_state') . ' = 4)))'),
450  'Records from online versions'
451  );
452  }
453 
454  #[Test]
456  {
457  $table = ‪StringUtility::getUniqueId('aTable');
458  ‪$GLOBALS['TCA'][$table] = [
459  'ctrl' => [
460  'versioningWS' => true,
461  ],
462  ];
463 
464  $context = new ‪Context();
465  $context->setAspect('workspace', new ‪WorkspaceAspect(2));
466  $subject = new ‪PageRepository($context);
467 
468  $conditions = $subject->getDefaultConstraints($table);
469  $connection = $this->get(ConnectionPool::class)->getConnectionForTable($table);
470  $expr = $connection->getExpressionBuilder();
471 
472  self::assertThat(
473  (string)$expr->and(...$conditions),
474  self::stringContains('((' . $connection->quoteIdentifier($table . '.t3ver_wsid') . ' = 0) OR (' . $connection->quoteIdentifier($table . '.t3ver_wsid') . ' = 2)'),
475  'No versioning placeholders'
476  );
477  }
478 
479  protected function ‪assertOverlayRow($row): void
480  {
481  self::assertIsArray($row);
482  self::assertArrayHasKey('_LOCALIZED_UID', $row);
483  }
484 
485  protected function ‪assertNotOverlayRow($row): void
486  {
487  self::assertIsArray($row);
488  self::assertFalse(isset($row['_LOCALIZED_UID']));
489  }
490 
491  #[Test]
492  public function ‪getPageIdsRecursiveTest(): void
493  {
494  $subject = new ‪PageRepository();
495  // empty array does not do anything
496  $result = $subject->getPageIdsRecursive([], 1);
497  self::assertEquals([], $result);
498  // pid=0 does not do anything
499  $result = $subject->getPageIdsRecursive([0], 1);
500  self::assertEquals([0], $result);
501  // depth=0 does return given ids int-casted
502  $result = $subject->getPageIdsRecursive(['1'], 0);
503  self::assertEquals([1], $result);
504  $result = $subject->getPageIdsRecursive([1], 1);
505  self::assertEquals([1, 2, 3, 4], $result);
506  $result = $subject->getPageIdsRecursive([1], 2);
507  self::assertEquals([1, 2, 5, 7, 3, 8, 9, 4, 10], $result);
508  $result = $subject->getPageIdsRecursive([1000], 99);
509  self::assertEquals([1000, 1001], $result);
510  }
511 
512  #[Test]
513  public function ‪getDescendantPageIdsRecursiveTest(): void
514  {
515  $subject = new ‪PageRepository();
516  // Negative numbers or "0" do not return anything
517  $result = $subject->getDescendantPageIdsRecursive(-1, 1);
518  self::assertEquals([], $result);
519  $result = $subject->getDescendantPageIdsRecursive(0, 1);
520  self::assertEquals([], $result);
521  $result = $subject->getDescendantPageIdsRecursive(1, 1);
522  self::assertEquals([2, 3, 4], $result);
523  $result = $subject->getDescendantPageIdsRecursive(1, 2);
524  self::assertEquals([2, 5, 7, 3, 8, 9, 4, 10], $result);
525  // "Begin" leaves out a level
526  $result = $subject->getDescendantPageIdsRecursive(1, 2, 1);
527  self::assertEquals([5, 7, 8, 9, 10], $result);
528  // Exclude a branch (3)
529  $result = $subject->getDescendantPageIdsRecursive(1, 2, excludePageIds: [3]);
530  self::assertEquals([2, 5, 7, 4, 10], $result);
531  // Include Page ID 6
532  $result = $subject->getDescendantPageIdsRecursive(1, 2, bypassEnableFieldsCheck: true);
533  self::assertEquals([2, 5, 6, 7, 3, 8, 9, 4, 10], $result);
534  }
535 
536  #[Test]
538  {
539  $context = new ‪Context();
540  $context->setAspect('language', new ‪LanguageAspect(1, 1, ‪LanguageAspect::OVERLAYS_ON_WITH_FLOATING, [0]));
541  $subject = new ‪PageRepository($context);
542  ‪$record = $subject->getRawRecord('tt_content', 1);
543  self::assertSame('Default Content #1', ‪$record['header']);
544  $overlaidRecord = $subject->getLanguageOverlay('tt_content', ‪$record);
545  self::assertSame(2, $overlaidRecord['_LOCALIZED_UID']);
546  self::assertSame('Translated Content #1', $overlaidRecord['header']);
547 
548  // Check if "bodytext" is actually overlaid with a NULL value
549  ‪$record = $subject->getRawRecord('tt_content', 3);
550  $overlaidRecord = $subject->getLanguageOverlay('tt_content', ‪$record);
551  self::assertSame('Translated #2', $overlaidRecord['header']);
552  self::assertNull($overlaidRecord['bodytext']);
553  }
554 
558  public static function invalidRowForVersionOLDataProvider(): array
559  {
560  return [
561  'no uid and no t3ver_oid' => [[]],
562  'zero uid and no t3ver_oid' => [['uid' => 0]],
563  'positive uid and no t3ver_oid' => [['uid' => 1]],
564  'no uid but t3ver_oid' => [['t3ver_oid' => 1]],
565  ];
566  }
567 
571  #[DataProvider('invalidRowForVersionOLDataProvider')]
572  #[Test]
573  public function ‪versionOLForAnInvalidRowUnchangedRowData(array $input): void
574  {
575  $context = new ‪Context();
576  $context->setAspect('workspace', new ‪WorkspaceAspect(4));
577  $subject = new ‪PageRepository($context);
578  $originalInput = $input;
579 
580  $subject->versionOL('pages', $input);
581 
582  self::assertSame($originalInput, $input);
583  }
584 
585  #[Test]
587  {
588  $modifyDefaultConstraintsForDatabaseQueryEvent = null;
589  $defaultConstraint = new ‪CompositeExpression('foo');
590 
592  $container = $this->get('service_container');
593  $container->set(
594  'modify-default-constraints-for-database-query-listener',
595  static function (‪ModifyDefaultConstraintsForDatabaseQueryEvent $event) use (&$modifyDefaultConstraintsForDatabaseQueryEvent, $defaultConstraint) {
596  $modifyDefaultConstraintsForDatabaseQueryEvent = $event;
597  $event->‪setConstraints([$defaultConstraint]);
598  }
599  );
600 
601  $eventListener = $container->get(ListenerProvider::class);
602  $eventListener->addListener(ModifyDefaultConstraintsForDatabaseQueryEvent::class, 'modify-default-constraints-for-database-query-listener');
603 
604  $table = ‪StringUtility::getUniqueId('aTable');
605  ‪$GLOBALS['TCA'][$table] = ['ctrl' => []];
606 
607  $defaultConstraints = (new ‪PageRepository(new ‪Context()))->getDefaultConstraints($table);
608 
609  self::assertEquals([$defaultConstraint], $defaultConstraints);
610  self::assertInstanceOf(ModifyDefaultConstraintsForDatabaseQueryEvent::class, $modifyDefaultConstraintsForDatabaseQueryEvent);
611  self::assertEquals($table, $modifyDefaultConstraintsForDatabaseQueryEvent->getTable());
612  self::assertEquals([$defaultConstraint], $modifyDefaultConstraintsForDatabaseQueryEvent->getConstraints());
613  }
614 
615  #[Test]
617  {
618  $pageId = 2004;
619  $page = new ‪Page(['uid' => $pageId]);
620  $beforePageIsRetrievedEvent = null;
621 
623  $container = $this->get('service_container');
624  $container->set(
625  'before-page-is-retrieved-listener',
626  static function (‪BeforePageIsRetrievedEvent $event) use (&$beforePageIsRetrievedEvent, $page, $pageId) {
627  $beforePageIsRetrievedEvent = $event;
628  $beforePageIsRetrievedEvent->‪setPageId($pageId);
629  $beforePageIsRetrievedEvent->setPage($page);
630  }
631  );
632 
633  $eventListener = $container->get(ListenerProvider::class);
634  $eventListener->addListener(BeforePageIsRetrievedEvent::class, 'before-page-is-retrieved-listener');
635 
636  $result = (new ‪PageRepository(new ‪Context()))->getPage(1234);
637 
638  self::assertEquals($page->getPageId(), $result['uid']);
639  self::assertInstanceOf(BeforePageIsRetrievedEvent::class, $beforePageIsRetrievedEvent);
640  self::assertEquals($page, $beforePageIsRetrievedEvent->getPage());
641  self::assertEquals($pageId, $beforePageIsRetrievedEvent->getPageId());
642  self::assertTrue($beforePageIsRetrievedEvent->hasPage());
643  }
644 }
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository
Definition: PageRepositoryTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getPagesOverlayByIdSingle
‪getPagesOverlayByIdSingle()
Definition: PageRepositoryTest.php:162
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getPageOverlayByRow
‪getPageOverlayByRow()
Definition: PageRepositoryTest.php:138
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getPagesOverlayByRowSingle
‪getPagesOverlayByRowSingle()
Definition: PageRepositoryTest.php:226
‪TYPO3\CMS\Core\Domain\Page
Definition: Page.php:24
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getPageOverlayByIdWithoutTranslation
‪getPageOverlayByIdWithoutTranslation()
Definition: PageRepositoryTest.php:129
‪TYPO3\CMS\Core\Context\WorkspaceAspect
Definition: WorkspaceAspect.php:31
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\previewShowsPagesFromLiveAndCurrentWorkspace
‪previewShowsPagesFromLiveAndCurrentWorkspace()
Definition: PageRepositoryTest.php:363
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getWorkspaceVersionReturnsTheCorrectMethod
‪getWorkspaceVersionReturnsTheCorrectMethod()
Definition: PageRepositoryTest.php:378
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getPageOverlayByRowWithoutTranslation
‪getPageOverlayByRowWithoutTranslation()
Definition: PageRepositoryTest.php:151
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getLanguageOverlayResolvesContentWithNullInValues
‪getLanguageOverlayResolvesContentWithNullInValues()
Definition: PageRepositoryTest.php:537
‪TYPO3\CMS\Core\Versioning\VersionState
‪VersionState
Definition: VersionState.php:22
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\beforePageIsRetrievedEventIsCalled
‪beforePageIsRetrievedEventIsCalled()
Definition: PageRepositoryTest.php:616
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\modifyDefaultConstraintsForDatabaseQueryEventIsCalled
‪modifyDefaultConstraintsForDatabaseQueryEventIsCalled()
Definition: PageRepositoryTest.php:586
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getPagesOverlayByIdMultiple
‪getPagesOverlayByIdMultiple()
Definition: PageRepositoryTest.php:180
‪TYPO3\CMS\Core\Domain\Event\BeforePageIsRetrievedEvent\setPageId
‪setPageId(int $pageId)
Definition: BeforePageIsRetrievedEvent.php:59
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getDescendantPageIdsRecursiveTest
‪getDescendantPageIdsRecursiveTest()
Definition: PageRepositoryTest.php:513
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getMenuSingleUidRoot
‪getMenuSingleUidRoot()
Definition: PageRepositoryTest.php:46
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getMenuPageOverlay
‪getMenuPageOverlay()
Definition: PageRepositoryTest.php:79
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:54
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getPageIdsRecursiveTest
‪getPageIdsRecursiveTest()
Definition: PageRepositoryTest.php:492
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest
Definition: PageRepositoryTest.php:38
‪TYPO3\CMS\Core\Database\Query\Expression\CompositeExpression
Definition: CompositeExpression.php:27
‪TYPO3\CMS\Core\Domain\Event\ModifyDefaultConstraintsForDatabaseQueryEvent\setConstraints
‪setConstraints(array $constraints)
Definition: ModifyDefaultConstraintsForDatabaseQueryEvent.php:66
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getPagesOverlayByIdMultipleSomeNotOverlaid
‪getPagesOverlayByIdMultipleSomeNotOverlaid()
Definition: PageRepositoryTest.php:205
‪TYPO3\CMS\Webhooks\Message\$record
‪identifier readonly int readonly array $record
Definition: PageModificationMessage.php:36
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getPagesOverlayByRowMultiple
‪getPagesOverlayByRowMultiple()
Definition: PageRepositoryTest.php:269
‪TYPO3\CMS\Core\Domain\Event\BeforePageIsRetrievedEvent
Definition: BeforePageIsRetrievedEvent.php:30
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getDefaultConstraintsHidesVersionedRecordsAndPlaceholders
‪getDefaultConstraintsHidesVersionedRecordsAndPlaceholders()
Definition: PageRepositoryTest.php:397
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\assertOverlayRow
‪assertOverlayRow($row)
Definition: PageRepositoryTest.php:479
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getMountPointInfoForDefaultLanguage
‪getMountPointInfoForDefaultLanguage()
Definition: PageRepositoryTest.php:338
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\assertNotOverlayRow
‪assertNotOverlayRow($row)
Definition: PageRepositoryTest.php:485
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getMountPointInfoForTranslation
‪getMountPointInfoForTranslation()
Definition: PageRepositoryTest.php:346
‪TYPO3\CMS\Core\Context\LanguageAspect
Definition: LanguageAspect.php:57
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\setUp
‪setUp()
Definition: PageRepositoryTest.php:39
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\groupRestrictedPageCanBeOverlaid
‪groupRestrictedPageCanBeOverlaid()
Definition: PageRepositoryTest.php:248
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getPageOverlayById
‪getPageOverlayById()
Definition: PageRepositoryTest.php:118
‪TYPO3\CMS\Core\Domain\Event\ModifyDefaultConstraintsForDatabaseQueryEvent
Definition: ModifyDefaultConstraintsForDatabaseQueryEvent.php:34
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getMenuSingleUidSubpage
‪getMenuSingleUidSubpage()
Definition: PageRepositoryTest.php:57
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getMenuMultipleUid
‪getMenuMultipleUid()
Definition: PageRepositoryTest.php:67
‪TYPO3\CMS\Core\Domain\Repository\PageRepository
Definition: PageRepository.php:69
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getDefaultConstraintsDoesFilterToCurrentAndLiveWorkspaceForRecordsInPreview
‪getDefaultConstraintsDoesFilterToCurrentAndLiveWorkspaceForRecordsInPreview()
Definition: PageRepositoryTest.php:455
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getMenuWithMountPoint
‪getMenuWithMountPoint()
Definition: PageRepositoryTest.php:93
‪TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_ON_WITH_FLOATING
‪const OVERLAYS_ON_WITH_FLOATING
Definition: LanguageAspect.php:77
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:24
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getDefaultConstraintsDoesNotHidePlaceholdersInPreview
‪getDefaultConstraintsDoesNotHidePlaceholdersInPreview()
Definition: PageRepositoryTest.php:425
‪TYPO3\CMS\Core\EventDispatcher\ListenerProvider
Definition: ListenerProvider.php:30
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getMenuPageOverlayWithMountPoint
‪getMenuPageOverlayWithMountPoint()
Definition: PageRepositoryTest.php:104
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static getUniqueId(string $prefix='')
Definition: StringUtility.php:57
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\getPagesOverlayByRowMultipleSomeNotOverlaid
‪getPagesOverlayByRowMultipleSomeNotOverlaid()
Definition: PageRepositoryTest.php:300
‪TYPO3\CMS\Core\Tests\Functional\Domain\Repository\PageRepositoryTest\versionOLForAnInvalidRowUnchangedRowData
‪static versionOLForAnInvalidRowUnchangedRowData(array $input)
Definition: PageRepositoryTest.php:573