2 declare(strict_types = 1);
18 use PHPUnit\Framework\MockObject\MockObject;
38 protected $testExtensionsToLoad = [
'typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example'];
63 protected function setUp()
67 $this->importCSVDataSet(ORIGINAL_ROOT .
'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/translatedBlogExampleData.csv');
70 $this->objectManager = GeneralUtility::makeInstance(\
TYPO3\CMS\
Extbase\Object\ObjectManager::class);
72 'features' => [
'consistentTranslationOverlayHandling' => 0],
76 'TYPO3\CMS\Extbase\Domain\Model\Category' => [
77 'mapping' => [
'tableName' =>
'sys_category']
82 $configurationManager = $this->objectManager->get(\
TYPO3\CMS\
Extbase\Configuration\ConfigurationManagerInterface::class);
83 $configurationManager->setConfiguration($configuration);
84 $this->postRepository = $this->objectManager->get(\
ExtbaseTeam\BlogExample\Domain\Repository\PostRepository::class);
85 $this->persistenceManager = $this->objectManager->get(PersistenceManager::class);
94 $environmentServiceMock = $this->createMock(EnvironmentService::class);
95 $environmentServiceMock
96 ->expects($this->atLeast(1))
97 ->method(
'isEnvironmentInFrontendMode')
99 GeneralUtility::setSingletonInstance(EnvironmentService::class, $environmentServiceMock);
101 $context = GeneralUtility::makeInstance(Context::class);
105 $frontendControllerMock = $this->createMock(\
TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class);
106 $frontendControllerMock->sys_page = $pageRepositoryFixture;
107 $GLOBALS[
'TSFE'] = $frontendControllerMock;
120 $context = GeneralUtility::makeInstance(Context::class);
123 $post2 = $this->postRepository->findByUid(2);
125 $this->assertEquals([
'Post 2', 2, 2,
'Blog 1', 1, 1,
'John', 1, 1], [
128 $post2->_getProperty(
'_localizedUid'),
129 $post2->getBlog()->getTitle(),
130 $post2->getBlog()->getUid(),
131 $post2->getBlog()->_getProperty(
'_localizedUid'),
132 $post2->getAuthor()->getFirstname(),
133 $post2->getAuthor()->getUid(),
134 $post2->getAuthor()->_getProperty(
'_localizedUid')
138 $this->persistenceManager->clearState();
140 $post2translated = $this->postRepository->findByUid(11);
141 $this->assertEquals([
'Post 2', 2, 2,
'Blog 1', 1, 1,
'John', 1, 1], [
142 $post2translated->getTitle(),
143 $post2translated->getUid(),
144 $post2translated->_getProperty(
'_localizedUid'),
145 $post2translated->getBlog()->getTitle(),
146 $post2translated->getBlog()->getUid(),
147 $post2translated->getBlog()->_getProperty(
'_localizedUid'),
148 $post2translated->getAuthor()->getFirstname(),
149 $post2translated->getAuthor()->getUid(),
150 $post2translated->getAuthor()->_getProperty(
'_localizedUid')
161 $context = GeneralUtility::makeInstance(Context::class);
164 $post2 = $this->postRepository->findByUid(2);
165 $this->assertEquals([
'Post 2', 2, 2,
'Blog 1', 1, 1,
'John', 1, 1], [
168 $post2->_getProperty(
'_localizedUid'),
169 $post2->getBlog()->getTitle(),
170 $post2->getBlog()->getUid(),
171 $post2->getBlog()->_getProperty(
'_localizedUid'),
172 $post2->getAuthor()->getFirstname(),
173 $post2->getAuthor()->getUid(),
174 $post2->getAuthor()->_getProperty(
'_localizedUid')
178 $this->persistenceManager->clearState();
180 $post2translated = $this->postRepository->findByUid(11);
181 $this->assertEquals([
'Post 2', 2, 2,
'Blog 1', 1, 1,
'John', 1, 1], [
182 $post2translated->getTitle(),
183 $post2translated->getUid(),
184 $post2translated->_getProperty(
'_localizedUid'),
185 $post2translated->getBlog()->getTitle(),
186 $post2translated->getBlog()->getUid(),
187 $post2translated->getBlog()->_getProperty(
'_localizedUid'),
188 $post2translated->getAuthor()->getFirstname(),
189 $post2translated->getAuthor()->getUid(),
190 $post2translated->getAuthor()->_getProperty(
'_localizedUid')
201 $context = GeneralUtility::makeInstance(Context::class);
204 $post2 = $this->postRepository->findByUid(2);
206 $this->persistenceManager->clearState();
207 $post2translated = $this->postRepository->findByUid(11);
209 foreach ([$post2, $post2translated] as $post) {
210 $this->assertEquals([
'Post 2 - DK', 2, 11,
'Blog 1 DK', 1, 2,
'Translated John', 1, 2], [
213 $post->_getProperty(
'_localizedUid'),
214 $post->getBlog()->getTitle(),
215 $post->getBlog()->getUid(),
216 $post->getBlog()->_getProperty(
'_localizedUid'),
217 $post->getAuthor()->getFirstname(),
218 $post->getAuthor()->getUid(),
219 $post->getAuthor()->_getProperty(
'_localizedUid')
231 $context = GeneralUtility::makeInstance(Context::class);
234 $post2 = $this->postRepository->findByUid(2);
235 $this->assertEquals([
'Post 2 - DK', 2, 11,
'Blog 1 DK', 1, 2,
'Translated John', 1, 2], [
238 $post2->_getProperty(
'_localizedUid'),
239 $post2->getBlog()->getTitle(),
240 $post2->getBlog()->getUid(),
241 $post2->getBlog()->_getProperty(
'_localizedUid'),
242 $post2->getAuthor()->getFirstname(),
243 $post2->getAuthor()->getUid(),
244 $post2->getAuthor()->_getProperty(
'_localizedUid')
248 $this->persistenceManager->clearState();
250 $post2translated = $this->postRepository->findByUid(11);
251 $this->assertEquals([
'Post 2 - DK', 2, 11,
'Blog 1 DK', 1, 2,
'Translated John', 1, 2], [
252 $post2translated->getTitle(),
253 $post2translated->getUid(),
254 $post2translated->_getProperty(
'_localizedUid'),
255 $post2translated->getBlog()->getTitle(),
256 $post2translated->getBlog()->getUid(),
257 $post2translated->getBlog()->_getProperty(
'_localizedUid'),
258 $post2translated->getAuthor()->getFirstname(),
259 $post2translated->getAuthor()->getUid(),
260 $post2translated->getAuthor()->_getProperty(
'_localizedUid')
276 $query = $this->postRepository->createQuery();
277 $querySettings = $query->getQuerySettings();
278 $querySettings->setLanguageUid(0);
279 $querySettings->setLanguageOverlayMode(
true);
280 $query->matching($query->equals(
'uid', 2));
281 $post2 = $query->execute()->getFirst();
283 $this->assertEquals([
'Post 2', 2, 2,
'Blog 1', 1, 1,
'John', 1, 1], [
286 $post2->_getProperty(
'_localizedUid'),
287 $post2->getBlog()->getTitle(),
288 $post2->getBlog()->getUid(),
289 $post2->getBlog()->_getProperty(
'_localizedUid'),
290 $post2->getAuthor()->getFirstname(),
291 $post2->getAuthor()->getUid(),
292 $post2->getAuthor()->_getProperty(
'_localizedUid')
296 $this->persistenceManager->clearState();
298 $query = $this->postRepository->createQuery();
299 $querySettings = $query->getQuerySettings();
300 $querySettings->setLanguageUid(0);
301 $querySettings->setLanguageOverlayMode(
true);
302 $query->matching($query->equals(
'uid', 11));
303 $post2 = $query->execute()->getFirst();
305 $this->assertNull($post2);
308 $this->persistenceManager->clearState();
310 $query = $this->postRepository->createQuery();
311 $querySettings = $query->getQuerySettings();
312 $querySettings->setLanguageUid(1);
313 $querySettings->setLanguageOverlayMode(
true);
314 $query->matching($query->equals(
'uid', 2));
315 $post2 = $query->execute()->getFirst();
317 $this->assertEquals([
'Post 2 - DK', 2, 11,
'Blog 1', 1, 1,
'John', 1, 1], [
320 $post2->_getProperty(
'_localizedUid'),
321 $post2->getBlog()->getTitle(),
322 $post2->getBlog()->getUid(),
323 $post2->getBlog()->_getProperty(
'_localizedUid'),
324 $post2->getAuthor()->getFirstname(),
325 $post2->getAuthor()->getUid(),
326 $post2->getAuthor()->_getProperty(
'_localizedUid')
330 $this->persistenceManager->clearState();
332 $query = $this->postRepository->createQuery();
333 $querySettings = $query->getQuerySettings();
334 $querySettings->setLanguageUid(1);
335 $querySettings->setLanguageOverlayMode(
true);
336 $query->matching($query->equals(
'uid', 11));
337 $post2 = $query->execute()->getFirst();
339 $this->assertNull($post2);
353 $query = $this->postRepository->createQuery();
354 $querySettings = $query->getQuerySettings();
355 $querySettings->setLanguageUid(0);
356 $querySettings->setLanguageOverlayMode(
false);
357 $query->matching($query->equals(
'uid', 2));
358 $post2 = $query->execute()->getFirst();
360 $this->assertEquals([
'Post 2', 2, 2,
'Blog 1', 1, 1,
'John', 1, 1], [
363 $post2->_getProperty(
'_localizedUid'),
364 $post2->getBlog()->getTitle(),
365 $post2->getBlog()->getUid(),
366 $post2->getBlog()->_getProperty(
'_localizedUid'),
367 $post2->getAuthor()->getFirstname(),
368 $post2->getAuthor()->getUid(),
369 $post2->getAuthor()->_getProperty(
'_localizedUid')
373 $this->persistenceManager->clearState();
375 $query = $this->postRepository->createQuery();
376 $querySettings = $query->getQuerySettings();
377 $querySettings->setLanguageUid(0);
378 $querySettings->setLanguageOverlayMode(
false);
379 $query->matching($query->equals(
'uid', 11));
380 $post2 = $query->execute()->getFirst();
382 $this->assertNull($post2);
385 $this->persistenceManager->clearState();
387 $query = $this->postRepository->createQuery();
388 $querySettings = $query->getQuerySettings();
389 $querySettings->setLanguageUid(1);
390 $querySettings->setLanguageOverlayMode(
false);
391 $query->matching($query->equals(
'uid', 2));
392 $post2 = $query->execute()->getFirst();
395 $this->assertEquals([
'Post 2 - DK', 2, 11,
'Blog 1', 1, 1,
'John', 1, 1], [
398 $post2->_getProperty(
'_localizedUid'),
399 $post2->getBlog()->getTitle(),
400 $post2->getBlog()->getUid(),
401 $post2->getBlog()->_getProperty(
'_localizedUid'),
402 $post2->getAuthor()->getFirstname(),
403 $post2->getAuthor()->getUid(),
404 $post2->getAuthor()->_getProperty(
'_localizedUid')
408 $this->persistenceManager->clearState();
410 $query = $this->postRepository->createQuery();
411 $querySettings = $query->getQuerySettings();
412 $querySettings->setLanguageUid(1);
413 $querySettings->setLanguageOverlayMode(
false);
414 $query->matching($query->equals(
'uid', 11));
415 $post2 = $query->execute()->getFirst();
417 $this->assertNull($post2);
421 $context = GeneralUtility::makeInstance(Context::class);
425 $this->persistenceManager->clearState();
427 $query = $this->postRepository->createQuery();
428 $querySettings = $query->getQuerySettings();
429 $querySettings->setLanguageUid(1);
430 $querySettings->setLanguageOverlayMode(
false);
431 $query->matching($query->equals(
'uid', 11));
432 $post2 = $query->execute()->getFirst();
434 $this->assertNull($post2);
444 '_localizedUid' => 4,
445 'content' =>
'A - content',
446 'blog.title' =>
'Blog 1',
448 'blog._localizedUid' => 1,
449 'author.firstname' =>
'John',
451 'author._localizedUid' => 1,
452 'secondAuthor.firstname' =>
'John',
453 'secondAuthor.uid' => 1,
454 'secondAuthor._localizedUid' => 1,
460 '_localizedUid' => 2,
461 'content' =>
'B - content',
462 'blog.title' =>
'Blog 1',
464 'blog._localizedUid' => 1,
465 'author.firstname' =>
'John',
467 'author._localizedUid' => 1,
468 'secondAuthor.firstname' =>
'John',
469 'secondAuthor.uid' => 1,
470 'secondAuthor._localizedUid' => 1,
471 'tags.0.name' =>
'Tag2',
473 'tags.0._localizedUid' => 2,
474 'tags.1.name' =>
'Tag3',
476 'tags.1._localizedUid' => 3,
477 'tags.2.name' =>
'Tag4',
479 'tags.2._localizedUid' => 4,
484 '_localizedUid' => 7,
485 'content' =>
'C - content',
486 'blog.title' =>
'Blog 1',
488 'blog._localizedUid' => 1,
489 'author.firstname' =>
'John',
491 'author._localizedUid' => 1,
492 'secondAuthor.firstname' =>
'John',
493 'secondAuthor.uid' => 1,
494 'secondAuthor._localizedUid' => 1,
500 '_localizedUid' => 6,
501 'content' =>
'F - content',
502 'blog.title' =>
'Blog 1',
504 'blog._localizedUid' => 1,
505 'author.firstname' =>
'John',
507 'author._localizedUid' => 1,
508 'secondAuthor.firstname' =>
'John',
509 'secondAuthor.uid' => 1,
510 'secondAuthor._localizedUid' => 1,
514 'title' =>
'Post 1 - not translated',
516 '_localizedUid' => 1,
517 'content' =>
'G - content',
518 'blog.title' =>
'Blog 1',
520 'blog._localizedUid' => 1,
521 'author.firstname' =>
'John',
523 'author._localizedUid' => 1,
524 'secondAuthor.firstname' =>
'Never translate me henry',
525 'secondAuthor.uid' => 3,
526 'secondAuthor._localizedUid' => 3,
527 'tags.0.name' =>
'Tag1',
529 'tags.0._localizedUid' => 1,
530 'tags.1.name' =>
'Tag2',
532 'tags.1._localizedUid' => 2,
533 'tags.2.name' =>
'Tag3',
535 'tags.2._localizedUid' => 3,
542 'expected' => $lang0Expected
547 'expected' => $lang0Expected
554 'title' =>
'Post 4 - DK',
556 '_localizedUid' => 12,
557 'content' =>
'U - content',
558 'blog.title' =>
'Blog 1',
560 'blog._localizedUid' => 1,
561 'author.firstname' =>
'John',
563 'author._localizedUid' => 1,
564 'secondAuthor.firstname' =>
'John',
565 'secondAuthor.uid' => 1,
566 'secondAuthor._localizedUid' => 1,
570 'title' =>
'Post 2 - DK',
572 '_localizedUid' => 11,
573 'content' =>
'C - content',
574 'blog.title' =>
'Blog 1',
576 'blog._localizedUid' => 1,
577 'author.firstname' =>
'John',
579 'author._localizedUid' => 1,
580 'secondAuthor.firstname' =>
'John',
581 'secondAuthor.uid' => 1,
582 'secondAuthor._localizedUid' => 1,
583 'tags.0.name' =>
'Tag2',
585 'tags.0._localizedUid' => 2,
586 'tags.1.name' =>
'Tag3',
588 'tags.1._localizedUid' => 3,
589 'tags.2.name' =>
'Tag4',
591 'tags.2._localizedUid' => 4,
594 'title' =>
'Post DK only',
596 '_localizedUid' => 15,
597 'content' =>
'B - content',
598 'blog.title' =>
'Blog 1',
600 'blog._localizedUid' => 1,
601 'author.firstname' =>
'John',
603 'author._localizedUid' => 1,
604 'secondAuthor.firstname' =>
'John',
605 'secondAuthor.uid' => 1,
606 'secondAuthor._localizedUid' => 1,
610 'title' =>
'Post 7 - DK',
612 '_localizedUid' => 14,
613 'content' =>
'S - content',
614 'blog.title' =>
'Blog 1',
616 'blog._localizedUid' => 1,
617 'author.firstname' =>
'John',
619 'author._localizedUid' => 1,
620 'secondAuthor.firstname' =>
'John',
621 'secondAuthor.uid' => 1,
622 'secondAuthor._localizedUid' => 1,
626 'title' =>
'Post 5 - DK',
628 '_localizedUid' => 13,
629 'content' =>
'A - content',
630 'blog.title' =>
'Blog 1',
632 'blog._localizedUid' => 1,
633 'author.firstname' =>
'John',
635 'author._localizedUid' => 1,
636 'secondAuthor.firstname' =>
'John',
637 'secondAuthor.uid' => 1,
638 'secondAuthor._localizedUid' => 1,
645 'overlay' =>
'hideNonTranslated',
648 'title' =>
'Post 4 - DK',
650 '_localizedUid' => 12,
651 'content' =>
'U - content',
652 'blog.title' =>
'Blog 1',
654 'blog._localizedUid' => 1,
655 'author.firstname' =>
'John',
657 'author._localizedUid' => 1,
658 'secondAuthor.firstname' =>
'John',
659 'secondAuthor.uid' => 1,
660 'secondAuthor._localizedUid' => 1,
664 'title' =>
'Post 2 - DK',
666 '_localizedUid' => 11,
667 'content' =>
'C - content',
668 'blog.title' =>
'Blog 1',
670 'blog._localizedUid' => 1,
671 'author.firstname' =>
'John',
673 'author._localizedUid' => 1,
674 'secondAuthor.firstname' =>
'John',
675 'secondAuthor.uid' => 1,
676 'secondAuthor._localizedUid' => 1,
677 'tags.0.name' =>
'Tag2',
679 'tags.0._localizedUid' => 2,
680 'tags.1.name' =>
'Tag3',
682 'tags.1._localizedUid' => 3,
683 'tags.2.name' =>
'Tag4',
685 'tags.2._localizedUid' => 4,
688 'title' =>
'Post DK only',
690 '_localizedUid' => 15,
691 'content' =>
'B - content',
692 'blog.title' =>
'Blog 1',
694 'blog._localizedUid' => 1,
695 'author.firstname' =>
'John',
697 'author._localizedUid' => 1,
698 'secondAuthor.firstname' =>
'John',
699 'secondAuthor.uid' => 1,
700 'secondAuthor._localizedUid' => 1,
704 'title' =>
'Post 7 - DK',
706 '_localizedUid' => 14,
707 'content' =>
'S - content',
708 'blog.title' =>
'Blog 1',
710 'blog._localizedUid' => 1,
711 'author.firstname' =>
'John',
713 'author._localizedUid' => 1,
714 'secondAuthor.firstname' =>
'John',
715 'secondAuthor.uid' => 1,
716 'secondAuthor._localizedUid' => 1,
721 'title' =>
'Post 5 - DK',
723 '_localizedUid' => 13,
724 'content' =>
'A - content',
725 'blog.title' =>
'Blog 1',
727 'blog._localizedUid' => 1,
728 'author.firstname' =>
'John',
730 'author._localizedUid' => 1,
731 'secondAuthor.firstname' =>
'John',
732 'secondAuthor.uid' => 1,
733 'secondAuthor._localizedUid' => 1,
743 'title' =>
'Post 4 - DK',
745 '_localizedUid' => 12,
746 'content' =>
'U - content',
747 'blog.title' =>
'Blog 1',
749 'blog._localizedUid' => 1,
750 'author.firstname' =>
'John',
752 'author._localizedUid' => 1,
753 'secondAuthor.firstname' =>
'John',
754 'secondAuthor.uid' => 1,
755 'secondAuthor._localizedUid' => 1,
759 'title' =>
'Post 2 - DK',
761 '_localizedUid' => 11,
762 'content' =>
'C - content',
763 'blog.title' =>
'Blog 1',
765 'blog._localizedUid' => 1,
766 'author.firstname' =>
'John',
768 'author._localizedUid' => 1,
769 'secondAuthor.firstname' =>
'John',
770 'secondAuthor.uid' => 1,
771 'secondAuthor._localizedUid' => 1,
772 'tags.0.name' =>
'Tag2',
774 'tags.0._localizedUid' => 2,
775 'tags.1.name' =>
'Tag3',
777 'tags.1._localizedUid' => 3,
778 'tags.2.name' =>
'Tag4',
780 'tags.2._localizedUid' => 4,
783 'title' =>
'Post DK only',
785 '_localizedUid' => 15,
786 'content' =>
'B - content',
787 'blog.title' =>
'Blog 1',
789 'blog._localizedUid' => 1,
790 'author.firstname' =>
'John',
792 'author._localizedUid' => 1,
793 'secondAuthor.firstname' =>
'John',
794 'secondAuthor.uid' => 1,
795 'secondAuthor._localizedUid' => 1,
799 'title' =>
'Post 7 - DK',
801 '_localizedUid' => 14,
802 'content' =>
'S - content',
803 'blog.title' =>
'Blog 1',
805 'blog._localizedUid' => 1,
806 'author.firstname' =>
'John',
808 'author._localizedUid' => 1,
809 'secondAuthor.firstname' =>
'John',
810 'secondAuthor.uid' => 1,
811 'secondAuthor._localizedUid' => 1,
815 'title' =>
'Post 5 - DK',
817 '_localizedUid' => 13,
818 'content' =>
'A - content',
819 'blog.title' =>
'Blog 1',
821 'blog._localizedUid' => 1,
822 'author.firstname' =>
'John',
824 'author._localizedUid' => 1,
825 'secondAuthor.firstname' =>
'John',
826 'secondAuthor.uid' => 1,
827 'secondAuthor._localizedUid' => 1,
849 $query = $this->postRepository->createQuery();
850 $querySettings = $query->getQuerySettings();
851 $querySettings->setLanguageUid($languageUid);
852 $querySettings->setLanguageOverlayMode($overlay);
854 $query->setOrderings([
859 $query->setOffset(0);
860 $posts = $query->execute()->toArray();
862 $this->assertCount(5, $posts);
872 '_localizedUid' => 5,
873 'content' =>
'Z - content',
874 'blog.title' =>
'Blog 1',
876 'blog._localizedUid' => 1,
877 'author.firstname' =>
'John',
879 'author._localizedUid' => 1,
880 'secondAuthor.firstname' =>
'John',
881 'secondAuthor.uid' => 1,
882 'secondAuthor._localizedUid' => 1,
887 '_localizedUid' => 6,
888 'content' =>
'F - content',
889 'blog.title' =>
'Blog 1',
891 'blog._localizedUid' => 1,
892 'author.firstname' =>
'John',
894 'author._localizedUid' => 1,
895 'secondAuthor.firstname' =>
'John',
896 'secondAuthor.uid' => 1,
897 'secondAuthor._localizedUid' => 1,
903 'title' =>
'Post 5 - DK',
905 '_localizedUid' => 13,
906 'content' =>
'A - content',
907 'blog.title' =>
'Blog 1',
909 'blog._localizedUid' => 1,
910 'author.firstname' =>
'John',
912 'author._localizedUid' => 1,
913 'secondAuthor.firstname' =>
'John',
914 'secondAuthor.uid' => 1,
915 'secondAuthor._localizedUid' => 1,
918 'title' =>
'Post DK only',
920 '_localizedUid' => 15,
921 'content' =>
'B - content',
922 'blog.title' =>
'Blog 1',
924 'blog._localizedUid' => 1,
925 'author.firstname' =>
'John',
927 'author._localizedUid' => 1,
928 'secondAuthor.firstname' =>
'John',
929 'secondAuthor.uid' => 1,
930 'secondAuthor._localizedUid' => 1,
938 'expected' => $lang0Expected
942 'overlay' =>
'hideNonTranslated',
943 'expected' => $lang0Expected
948 'expected' => $lang0Expected
953 'expected' => $lang1Expected
957 'overlay' =>
'hideNonTranslated',
958 'expected' => $lang1Expected,
963 'expected' => $lang1Expected,
986 $query = $this->postRepository->createQuery();
987 $querySettings = $query->getQuerySettings();
988 $querySettings->setLanguageUid($languageUid);
989 $querySettings->setLanguageOverlayMode($overlay);
993 $query->like(
'title',
'Post 5%'),
994 $query->like(
'title',
'Post 6%'),
995 $query->like(
'title',
'Post DK only')
999 $posts = $query->execute()->toArray();
1001 $this->assertCount(count($expected), $posts);
1009 'title' =>
'Blog 1',
1011 '_localizedUid' => 1,
1014 'title' =>
'Blog 1',
1016 '_localizedUid' => 1,
1021 'title' =>
'Blog 1 DK',
1023 '_localizedUid' => 2,
1026 'title' =>
'Blog 1 DK',
1028 '_localizedUid' => 2,
1036 'expected' => $lang0Expected
1042 'expected' => $lang0Expected
1048 'expected' => $lang0Expected
1054 'expected' => $lang0Expected
1060 'expected' => $lang1Expected
1066 'expected' => $lang1Expected
1072 'expected' => $lang1Expected
1078 'expected' => $lang1Expected
1100 $context = GeneralUtility::makeInstance(Context::class);
1101 $context->setAspect(
'language',
new LanguageAspect($languageUid, $languageUid, $overlay));
1103 $blogRepository = $this->objectManager->get(\
ExtbaseTeam\BlogExample\Domain\Repository\BlogRepository::class);
1104 $query = $blogRepository->createQuery();
1105 $querySettings = $query->getQuerySettings();
1106 $querySettings->setLanguageMode($languageMode);
1107 $querySettings->setRespectSysLanguage(
false);
1109 $posts = $query->execute()->toArray();
1111 $this->assertCount(count($expected), $posts);
1124 foreach ($objects as $key => $post) {
1126 $propertiesToCheck = array_keys($expected[$key]);
1127 foreach ($propertiesToCheck as $propertyPath) {
1130 $actual[] = $actualPost;
1131 $this->assertEquals($expected[$key], $actual[$key],
'Assertion of the $expected[' . $key .
'] failed');
1133 $this->assertEquals($expected, $actual);
1147 $propertyPathSegments = explode(
'.', $propertyPath);
1149 foreach ($propertyPathSegments as $pathSegment) {
1151 if ($subject instanceof \SplObjectStorage || $subject instanceof ObjectStorage) {
1152 $subject = iterator_to_array(clone $subject,
false);
1155 }
catch (\
TYPO3\CMS\
Extbase\Reflection\Exception\PropertyNotAccessibleException $error) {