‪TYPO3CMS  9.5
RelationTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
30 
31 class ‪RelationTest extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase
32 {
36  protected ‪$blog;
37 
42 
43  protected ‪$testExtensionsToLoad = ['typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example'];
44 
45  protected ‪$coreExtensionsToLoad = ['extbase', 'fluid'];
46 
50  protected ‪$objectManager;
51 
55  protected function ‪setUp()
56  {
57  parent::setUp();
58 
59  $this->importDataSet('PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/pages.xml');
60  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/blogs.xml');
61  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/posts.xml');
62  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/persons.xml');
63  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/tags.xml');
64  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/tags-mm.xml');
65  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/post-tag-mm.xml');
66  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/categories.xml');
67  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/category-mm.xml');
68 
69  $this->objectManager = GeneralUtility::makeInstance(\‪TYPO3\CMS\‪Extbase\Object\ObjectManager::class);
70  $this->persistentManager = $this->objectManager->get(\‪TYPO3\CMS\‪Extbase\Persistence\Generic\PersistenceManager::class);
71  /* @var $blogRepository \TYPO3\CMS\Extbase\Persistence\Repository */
72  $blogRepository = $this->objectManager->get(BlogRepository::class);
73  $this->blog = $blogRepository->findByUid(1);
74 
75  ‪$GLOBALS['BE_USER'] = new ‪BackendUserAuthentication();
76  ‪$GLOBALS['BE_USER']->workspace = 0;
77  }
78 
84  public function ‪attachPostToBlogAtTheEnd()
85  {
86  $queryBuilder = (new ‪ConnectionPool())->getQueryBuilderForTable('tx_blogexample_domain_model_post');
87  $queryBuilder->getRestrictions()->removeAll();
88  $countPostsOriginal = $queryBuilder
89  ->count('*')
90  ->from('tx_blogexample_domain_model_post')
91  ->where(
92  $queryBuilder->expr()->eq(
93  'blog',
94  $queryBuilder->createNamedParameter($this->blog->getUid(), \PDO::PARAM_INT)
95  )
96  )->execute()
97  ->fetchColumn(0);
98 
99  $newPostTitle = 'sdufhisdhuf';
101  $newPost = $this->objectManager->get(Post::class);
102  $newPost->setBlog($this->blog);
103  $newPost->setTitle($newPostTitle);
104  $newPost->setContent('Bla Bla Bla');
105 
106  $this->blog->addPost($newPost);
107  $this->‪updateAndPersistBlog();
108 
109  $queryBuilder->resetQueryParts();
110  $countPosts = $queryBuilder
111  ->count('*')
112  ->from('tx_blogexample_domain_model_post')
113  ->where(
114  $queryBuilder->expr()->eq(
115  'blog',
116  $queryBuilder->createNamedParameter($this->blog->getUid(), \PDO::PARAM_INT)
117  )
118  )->execute()
119  ->fetchColumn(0);
120  $this->assertEquals($countPostsOriginal + 1, $countPosts);
121 
122  $queryBuilder->resetQueryParts();
123  $post = $queryBuilder
124  ->select('title', 'sorting')
125  ->from('tx_blogexample_domain_model_post')
126  ->where(
127  $queryBuilder->expr()->eq(
128  'blog',
129  $queryBuilder->createNamedParameter($this->blog->getUid(), \PDO::PARAM_INT)
130  )
131  )->orderBy('sorting', 'DESC')
132  ->execute()
133  ->fetch();
134  $this->assertSame($newPostTitle, $post['title']);
135  $this->assertEquals($countPostsOriginal + 1, $post['sorting']);
136  }
137 
143  public function ‪removeLastPostFromBlog()
144  {
145  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_domain_model_post');
146  $queryBuilder->getRestrictions()
147  ->removeAll()->add(new DeletedRestriction());
148  $countPostsOriginal = $queryBuilder
149  ->count('*')
150  ->from('tx_blogexample_domain_model_post')
151  ->execute()
152  ->fetchColumn(0);
153 
154  $queryBuilder->resetQueryParts();
155  $post = $queryBuilder
156  ->select('title', 'sorting')
157  ->from('tx_blogexample_domain_model_post')
158  ->where(
159  $queryBuilder->expr()->eq(
160  'blog',
161  $queryBuilder->createNamedParameter($this->blog->getUid(), \PDO::PARAM_INT)
162  )
163  )->orderBy('sorting', 'DESC')
164  ->execute()
165  ->fetch();
166  $this->assertEquals(10, $post['sorting']);
167 
168  $posts = $this->blog->getPosts();
169  $postsArray = $posts->toArray();
170  $latestPost = array_pop($postsArray);
171 
172  $this->assertEquals(10, $latestPost->getUid());
173 
174  $this->blog->removePost($latestPost);
175  $this->‪updateAndPersistBlog();
176 
177  $queryBuilder->resetQueryParts();
178  $countPosts = $queryBuilder
179  ->count('*')
180  ->from('tx_blogexample_domain_model_post')
181  ->execute()
182  ->fetchColumn(0);
183  $this->assertEquals($countPostsOriginal - 1, $countPosts);
184 
185  $queryBuilder->resetQueryParts();
186  $post = $queryBuilder
187  ->select('title', 'sorting')
188  ->from('tx_blogexample_domain_model_post')
189  ->where(
190  $queryBuilder->expr()->eq(
191  'uid',
192  $queryBuilder->createNamedParameter($latestPost->getUid(), \PDO::PARAM_INT)
193  )
194  )->orderBy('sorting', 'DESC')
195  ->execute()
196  ->fetch();
197  $this->assertNull($post['uid']);
198 
199  $queryBuilder->resetQueryParts();
200  $post = $queryBuilder
201  ->select('title', 'sorting')
202  ->from('tx_blogexample_domain_model_post')
203  ->where(
204  $queryBuilder->expr()->eq(
205  'blog',
206  $queryBuilder->createNamedParameter($this->blog->getUid(), \PDO::PARAM_INT)
207  )
208  )->orderBy('sorting', 'DESC')
209  ->execute()
210  ->fetch();
211  $this->assertSame('Post9', $post['title']);
212  $this->assertEquals(9, $post['sorting']);
213  }
214 
220  public function ‪addPostToBlogInTheMiddle()
221  {
222  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_domain_model_post');
223  $queryBuilder->getRestrictions()
224  ->removeAll()->add(new DeletedRestriction());
225  $countPostsOriginal = $queryBuilder
226  ->count('*')
227  ->from('tx_blogexample_domain_model_post')
228  ->execute()
229  ->fetchColumn(0);
230 
232  $newPost = $this->objectManager->get(Post::class);
233 
234  $posts = clone $this->blog->getPosts();
235  $this->blog->getPosts()->removeAll($posts);
236  $counter = 1;
237  $newPostTitle = 'INSERTED POST at position 6';
238  foreach ($posts as $post) {
239  $this->blog->addPost($post);
240  if ($counter === 5) {
241  $newPost->setBlog($this->blog);
242  $newPost->setTitle($newPostTitle);
243  $newPost->setContent('Bla Bla Bla');
244  $this->blog->addPost($newPost);
245  }
246  $counter++;
247  }
248  $this->‪updateAndPersistBlog();
249 
250  $queryBuilder->resetQueryParts();
251  $countPosts = $queryBuilder
252  ->count('*')
253  ->from('tx_blogexample_domain_model_post')
254  ->execute()
255  ->fetchColumn(0);
256  $this->assertEquals($countPostsOriginal + 1, $countPosts);
257 
258  //last post
259  $queryBuilder->resetQueryParts();
260  $post = $queryBuilder
261  ->select('title', 'sorting')
262  ->from('tx_blogexample_domain_model_post')
263  ->where(
264  $queryBuilder->expr()->eq(
265  'blog',
266  $queryBuilder->createNamedParameter($this->blog->getUid(), \PDO::PARAM_INT)
267  )
268  )->orderBy('sorting', 'DESC')
269  ->execute()
270  ->fetch();
271  $this->assertSame('Post10', $post['title']);
272  $this->assertEquals(11, $post['sorting']);
273 
274  // check sorting of the post added in the middle
275  $queryBuilder->resetQueryParts();
276  $post = $queryBuilder
277  ->select('title', 'sorting')
278  ->from('tx_blogexample_domain_model_post')
279  ->where(
280  $queryBuilder->expr()->eq(
281  'uid',
282  $queryBuilder->createNamedParameter($newPost->getUid(), \PDO::PARAM_INT)
283  )
284  )->orderBy('sorting', 'DESC')
285  ->execute()
286  ->fetch();
287  $this->assertSame($newPostTitle, $post['title']);
288  $this->assertEquals(6, $post['sorting']);
289  }
290 
296  public function ‪removeMiddlePostFromBlog()
297  {
298  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_domain_model_post');
299  $queryBuilder->getRestrictions()
300  ->removeAll()->add(new DeletedRestriction());
301  $countPostsOriginal = $queryBuilder
302  ->count('*')
303  ->from('tx_blogexample_domain_model_post')
304  ->execute()
305  ->fetchColumn(0);
306 
307  $posts = clone $this->blog->getPosts();
308  $counter = 1;
309  foreach ($posts as $post) {
310  if ($counter === 5) {
311  $this->blog->removePost($post);
312  }
313  $counter++;
314  }
315  $this->‪updateAndPersistBlog();
316 
317  $queryBuilder->resetQueryParts();
318  $countPosts = $queryBuilder
319  ->count('*')
320  ->from('tx_blogexample_domain_model_post')
321  ->execute()
322  ->fetchColumn(0);
323  $this->assertEquals($countPostsOriginal - 1, $countPosts);
324 
325  $queryBuilder->resetQueryParts();
326  $post = $queryBuilder
327  ->select('title', 'sorting')
328  ->from('tx_blogexample_domain_model_post')
329  ->where(
330  $queryBuilder->expr()->eq(
331  'blog',
332  $queryBuilder->createNamedParameter($this->blog->getUid(), \PDO::PARAM_INT)
333  )
334  )->orderBy('sorting', 'DESC')
335  ->execute()
336  ->fetch();
337  $this->assertSame('Post10', $post['title']);
338  $this->assertEquals(10, $post['sorting']);
339  }
340 
346  public function ‪movePostFromEndToTheMiddle()
347  {
348  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_domain_model_post');
349  $queryBuilder->getRestrictions()
350  ->removeAll()->add(new DeletedRestriction());
351  $countPostsOriginal = $queryBuilder
352  ->count('*')
353  ->from('tx_blogexample_domain_model_post')
354  ->execute()
355  ->fetchColumn(0);
356 
357  $posts = clone $this->blog->getPosts();
358  $postsArray = $posts->toArray();
359  $latestPost = array_pop($postsArray);
360 
361  $this->blog->getPosts()->removeAll($posts);
362  $counter = 0;
363  $postCount = $posts->count();
364  foreach ($posts as $post) {
365  if ($counter !== ($postCount - 1)) {
366  $this->blog->addPost($post);
367  }
368  if ($counter === 4) {
369  $latestPost->setTitle('MOVED POST ' . $latestPost->getTitle());
370  $this->blog->addPost($latestPost);
371  }
372  $counter++;
373  }
374  $this->‪updateAndPersistBlog();
375 
376  $queryBuilder->resetQueryParts();
377  $countPosts = $queryBuilder
378  ->count('*')
379  ->from('tx_blogexample_domain_model_post')
380  ->execute()
381  ->fetchColumn(0);
382  $this->assertEquals($countPostsOriginal, $countPosts);
383 
384  $queryBuilder->getRestrictions()->removeAll();
385  $post = $queryBuilder
386  ->select('title', 'sorting')
387  ->from('tx_blogexample_domain_model_post')
388  ->where(
389  $queryBuilder->expr()->eq(
390  'blog',
391  $queryBuilder->createNamedParameter($this->blog->getUid(), \PDO::PARAM_INT)
392  )
393  )->orderBy('sorting', 'DESC')
394  ->execute()
395  ->fetch();
396  $this->assertSame('Post9', $post['title']);
397  $this->assertEquals(10, $post['sorting']);
398 
399  $queryBuilder->resetQueryParts();
400  $post = $queryBuilder
401  ->select('title', 'uid')
402  ->from('tx_blogexample_domain_model_post')
403  ->where(
404  $queryBuilder->expr()->andX(
405  $queryBuilder->expr()->eq(
406  'blog',
407  $queryBuilder->createNamedParameter($this->blog->getUid(), \PDO::PARAM_INT)
408  ),
409  $queryBuilder->expr()->eq('sorting', $queryBuilder->createNamedParameter(6, \PDO::PARAM_INT))
410  )
411  )
412  ->execute()
413  ->fetch();
414  $this->assertSame('MOVED POST Post10', $post['title']);
415  $this->assertEquals(10, $post['uid']);
416  }
417 
423  public function ‪attachTagToPostAtTheEnd()
424  {
425  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_domain_model_tag');
426  $queryBuilder->getRestrictions()
427  ->removeAll();
428  $countOriginal = $queryBuilder
429  ->count('*')
430  ->from('tx_blogexample_domain_model_tag')
431  ->execute()
432  ->fetchColumn(0);
433 
434  $newTagTitle = 'sdufhisdhuf';
435 
437  $newTag = $this->objectManager->get('ExtbaseTeam\\BlogExample\\Domain\\Model\\Tag', $newTagTitle);
438 
440  $postRepository = $this->objectManager->get(PostRepository::class);
441  $post = $postRepository->findByUid(1);
442  $post->addTag($newTag);
443 
444  $postRepository->update($post);
445  $this->persistentManager->persistAll();
446 
447  $queryBuilder->resetQueryParts();
448  $count = $queryBuilder
449  ->count('*')
450  ->from('tx_blogexample_domain_model_tag')
451  ->execute()
452  ->fetchColumn(0);
453  $this->assertEquals($countOriginal + 1, $count);
454 
455  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_post_tag_mm');
456  $queryBuilder->getRestrictions()
457  ->removeAll();
458  $tag = $queryBuilder
459  ->select('uid_foreign')
460  ->from('tx_blogexample_post_tag_mm')
461  ->where(
462  $queryBuilder->expr()->eq(
463  'uid_local',
464  $queryBuilder->createNamedParameter($post->getUid(), \PDO::PARAM_INT)
465  )
466  )->orderBy('sorting', 'DESC')
467  ->execute()
468  ->fetch();
469  $this->assertEquals($newTag->getUid(), $tag['uid_foreign']);
470  }
471 
477  public function ‪removeLastTagFromPost()
478  {
479  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_domain_model_tag');
480  $queryBuilder->getRestrictions()
481  ->removeAll()->add(new DeletedRestriction());
482  $countOriginal = $queryBuilder
483  ->count('*')
484  ->from('tx_blogexample_domain_model_tag')
485  ->execute()
486  ->fetchColumn(0);
487 
489  $postRepository = $this->objectManager->get(PostRepository::class);
490  $post = $postRepository->findByUid(1);
491  $tags = $post->getTags();
492  $tagsArray = $tags->toArray();
493  $latestTag = array_pop($tagsArray);
494 
495  $this->assertEquals(10, $latestTag->getUid());
496 
497  $post->removeTag($latestTag);
498 
499  $postRepository->update($post);
500  $this->persistentManager->persistAll();
501 
502  $queryBuilder->resetQueryParts();
503  $countTags = $queryBuilder
504  ->count('*')
505  ->from('tx_blogexample_domain_model_tag')
506  ->execute()
507  ->fetchColumn(0);
508  $this->assertEquals($countOriginal, $countTags);
509 
510  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_post_tag_mm');
511  $queryBuilder->getRestrictions()
512  ->removeAll();
513  $tag = $queryBuilder
514  ->select('uid_foreign')
515  ->from('tx_blogexample_post_tag_mm')
516  ->where(
517  $queryBuilder->expr()->eq(
518  'uid_local',
519  $queryBuilder->createNamedParameter($post->getUid(), \PDO::PARAM_INT)
520  )
521  )->orderBy('sorting', 'DESC')
522  ->execute()
523  ->fetch();
524  $this->assertEquals(9, $tag['uid_foreign']);
525 
526  $queryBuilder->resetQueryParts();
527  $tag = $queryBuilder
528  ->select('uid_foreign')
529  ->from('tx_blogexample_post_tag_mm')
530  ->where(
531  $queryBuilder->expr()->andX(
532  $queryBuilder->expr()->eq(
533  'uid_local',
534  $queryBuilder->createNamedParameter($post->getUid(), \PDO::PARAM_INT)
535  ),
536  $queryBuilder->expr()->eq(
537  'uid_foreign',
538  $queryBuilder->createNamedParameter($latestTag->getUid(), \PDO::PARAM_INT)
539  )
540  )
541  )->orderBy('sorting', 'DESC')
542  ->execute()
543  ->fetch();
544  $this->assertNull($tag['uid_foreign']);
545  }
546 
552  public function ‪addTagToPostInTheMiddle()
553  {
554  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_post_tag_mm');
555  $queryBuilder->getRestrictions()
556  ->removeAll();
557  $countTagsOriginal = $queryBuilder
558  ->count('*')
559  ->from('tx_blogexample_post_tag_mm')
560  ->where(
561  $queryBuilder->expr()->eq('uid_local', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
562  )
563  ->execute()
564  ->fetchColumn(0);
565 
567  $postRepository = $this->objectManager->get(PostRepository::class);
568  $post = $postRepository->findByUid(1);
569  $tags = clone $post->getTags();
570  $post->setTags(new ObjectStorage());
571 
573  $newTag = $this->objectManager->get(Tag::class, 'INSERTED TAG at position 6 : ' . strftime(''));
574 
575  $counter = 1;
576  foreach ($tags as $tag) {
577  $post->addTag($tag);
578  if ($counter === 5) {
579  $post->addTag($newTag);
580  }
581  $counter++;
582  }
583 
584  $postRepository->update($post);
585  $this->persistentManager->persistAll();
586 
587  $queryBuilder->resetQueryParts();
588  $countTags = $queryBuilder
589  ->count('*')
590  ->from('tx_blogexample_post_tag_mm')
591  ->where(
592  $queryBuilder->expr()->eq('uid_local', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
593  )
594  ->execute()
595  ->fetchColumn(0);
596  $this->assertEquals($countTagsOriginal + 1, $countTags);
597 
598  $queryBuilder->resetQueryParts();
599  $tag = $queryBuilder
600  ->select('uid_foreign')
601  ->from('tx_blogexample_post_tag_mm')
602  ->where(
603  $queryBuilder->expr()->eq(
604  'uid_local',
605  $queryBuilder->createNamedParameter($post->getUid(), \PDO::PARAM_INT)
606  )
607  )->orderBy('sorting', 'DESC')
608  ->execute()
609  ->fetch();
610  $this->assertEquals(10, $tag['uid_foreign']);
611 
612  $queryBuilder->resetQueryParts();
613  $tag = $queryBuilder
614  ->select('uid_foreign')
615  ->from('tx_blogexample_post_tag_mm')
616  ->where(
617  $queryBuilder->expr()->andX(
618  $queryBuilder->expr()->eq(
619  'uid_local',
620  $queryBuilder->createNamedParameter($post->getUid(), \PDO::PARAM_INT)
621  ),
622  $queryBuilder->expr()->eq('sorting', $queryBuilder->createNamedParameter(6, \PDO::PARAM_INT))
623  )
624  )->orderBy('sorting', 'DESC')
625  ->execute()
626  ->fetch();
627  $this->assertEquals($newTag->getUid(), $tag['uid_foreign']);
628  }
629 
635  public function ‪removeMiddleTagFromPost()
636  {
637  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_post_tag_mm');
638  $queryBuilder->getRestrictions()
639  ->removeAll();
640  $countTags = $queryBuilder
641  ->count('*')
642  ->from('tx_blogexample_post_tag_mm')
643  ->where(
644  $queryBuilder->expr()->eq('uid_local', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
645  )
646  ->execute()
647  ->fetchColumn(0);
648  $this->assertEquals(10, $countTags);
649 
651  $postRepository = $this->objectManager->get(PostRepository::class);
652  $post = $postRepository->findByUid(1);
653  $tags = clone $post->getTags();
654  $counter = 1;
655  foreach ($tags as $tag) {
656  if ($counter === 5) {
657  $post->removeTag($tag);
658  }
659  $counter++;
660  }
661 
662  $postRepository->update($post);
663  $this->persistentManager->persistAll();
664 
665  $queryBuilder->resetQueryParts();
666  $countTags = $queryBuilder
667  ->count('*')
668  ->from('tx_blogexample_post_tag_mm')
669  ->where(
670  $queryBuilder->expr()->eq('uid_local', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
671  )
672  ->execute()
673  ->fetchColumn(0);
674  $this->assertEquals(9, $countTags);
675 
676  $queryBuilder->resetQueryParts();
677  $tag = $queryBuilder
678  ->select('uid_foreign', 'sorting')
679  ->from('tx_blogexample_post_tag_mm')
680  ->where(
681  $queryBuilder->expr()->eq(
682  'uid_local',
683  $queryBuilder->createNamedParameter($post->getUid(), \PDO::PARAM_INT)
684  )
685  )->orderBy('sorting', 'DESC')
686  ->execute()
687  ->fetch();
688  $this->assertEquals(10, $tag['uid_foreign']);
689  $this->assertEquals(10, $tag['sorting']);
690 
691  $queryBuilder->resetQueryParts();
692  $tag = $queryBuilder
693  ->select('uid_foreign')
694  ->from('tx_blogexample_post_tag_mm')
695  ->where(
696  $queryBuilder->expr()->andX(
697  $queryBuilder->expr()->eq(
698  'uid_local',
699  $queryBuilder->createNamedParameter($post->getUid(), \PDO::PARAM_INT)
700  ),
701  $queryBuilder->expr()->eq('sorting', $queryBuilder->createNamedParameter(5, \PDO::PARAM_INT))
702  )
703  )
704  ->execute()
705  ->fetch();
706  $this->assertNull($tag['uid_foreign']);
707  }
708 
714  public function ‪moveTagFromEndToTheMiddle()
715  {
716  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_post_tag_mm');
717  $queryBuilder->getRestrictions()
718  ->removeAll();
719  $countTags = $queryBuilder
720  ->count('*')
721  ->from('tx_blogexample_post_tag_mm')
722  ->where(
723  $queryBuilder->expr()->eq('uid_local', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
724  )
725  ->execute()
726  ->fetchColumn(0);
727  $this->assertEquals(10, $countTags);
728 
730  $postRepository = $this->objectManager->get(PostRepository::class);
731  $post = $postRepository->findByUid(1);
732  $tags = clone $post->getTags();
733  $tagsArray = $tags->toArray();
734  $latestTag = array_pop($tagsArray);
735  $post->removeTag($latestTag);
736  $post->setTags(new ObjectStorage());
737 
738  $counter = 1;
739  $tagCount = $tags->count();
740  foreach ($tags as $tag) {
741  if ($counter !== $tagCount) {
742  $post->addTag($tag);
743  }
744  if ($counter === 5) {
745  $post->addTag($latestTag);
746  }
747  $counter++;
748  }
749  $post->addTag($latestTag);
750 
751  $postRepository->update($post);
752  $this->persistentManager->persistAll();
753 
754  $queryBuilder->resetQueryParts();
755  $countTags = $queryBuilder
756  ->count('*')
757  ->from('tx_blogexample_post_tag_mm')
758  ->where(
759  $queryBuilder->expr()->eq('uid_local', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
760  )
761  ->execute()
762  ->fetchColumn(0);
763  $this->assertEquals(10, $countTags);
764 
765  $queryBuilder->resetQueryParts();
766  $tag = $queryBuilder
767  ->select('uid_foreign', 'sorting')
768  ->from('tx_blogexample_post_tag_mm')
769  ->where(
770  $queryBuilder->expr()->eq(
771  'uid_local',
772  $queryBuilder->createNamedParameter($post->getUid(), \PDO::PARAM_INT)
773  )
774  )->orderBy('sorting', 'DESC')
775  ->execute()
776  ->fetch();
777  $this->assertEquals(9, $tag['uid_foreign']);
778  $this->assertEquals(10, $tag['sorting']);
779 
780  $sorting = '6';
781  $queryBuilder->resetQueryParts();
782  $tag = $queryBuilder
783  ->select('uid_foreign')
784  ->from('tx_blogexample_post_tag_mm')
785  ->where(
786  $queryBuilder->expr()->andX(
787  $queryBuilder->expr()->eq(
788  'uid_local',
789  $queryBuilder->createNamedParameter($post->getUid(), \PDO::PARAM_INT)
790  ),
791  $queryBuilder->expr()->eq(
792  'sorting',
793  $queryBuilder->createNamedParameter($sorting, \PDO::PARAM_STR)
794  )
795  )
796  )
797  ->execute()
798  ->fetch();
799  $this->assertEquals(10, $tag['uid_foreign']);
800  }
801 
807  public function ‪timestampFieldIsUpdatedOnPostSave()
808  {
809  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tx_blogexample_domain_model_post');
810  $queryBuilder->getRestrictions()
811  ->removeAll();
812  $rawPost = $queryBuilder
813  ->select('*')
814  ->from('tx_blogexample_domain_model_post')
815  ->where(
816  $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
817  )
818  ->execute()
819  ->fetch();
820 
822  $postRepository = $this->objectManager->get(PostRepository::class);
823  $post = $postRepository->findByUid(1);
824  $post->setTitle('newTitle');
825 
826  $postRepository->update($post);
827  $this->persistentManager->persistAll();
828 
829  $queryBuilder->resetQueryParts();
830  $rawPost2 = $queryBuilder
831  ->select('*')
832  ->from('tx_blogexample_domain_model_post')
833  ->where(
834  $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
835  )
836  ->execute()
837  ->fetch();
838  $this->assertTrue($rawPost2['tstamp'] > $rawPost['tstamp']);
839  }
840 
847  {
849  $postRepository = $this->objectManager->get(PostRepository::class);
850  $posts = $postRepository->findByTagAndBlog('Tag2', $this->blog);
851  $this->assertCount(1, $posts);
852  }
853 
858  {
859  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('sys_category_record_mm');
860  $queryBuilder->getRestrictions()
861  ->removeAll();
862  $countCategories = $queryBuilder
863  ->count('*')
864  ->from('sys_category_record_mm')
865  ->where(
866  $queryBuilder->expr()->andX(
867  $queryBuilder->expr()->eq('uid_foreign', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT)),
868  $queryBuilder->expr()->eq(
869  'tablenames',
870  $queryBuilder->createNamedParameter('tx_blogexample_domain_model_post', \PDO::PARAM_STR)
871  ),
872  $queryBuilder->expr()->eq(
873  'fieldname',
874  $queryBuilder->createNamedParameter('categories', \PDO::PARAM_STR)
875  )
876  )
877  )
878  ->execute()
879  ->fetchColumn(0);
880  $this->assertEquals(4, $countCategories);
881 
883  $postRepository = $this->objectManager->get(PostRepository::class);
884  $post = $postRepository->findByUid(1);
885  $this->assertSame(3, count($post->getCategories()));
886  }
887 
894  {
896  $postRepository = $this->objectManager->get(PostRepository::class);
897  $posts = $postRepository->findByCategory(1);
898  $this->assertSame(2, count($posts));
899 
900  $posts = $postRepository->findByCategory(4);
901  $this->assertSame(0, count($posts));
902  }
903 
908  {
909  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('sys_category_record_mm');
910  $queryBuilder->getRestrictions()
911  ->removeAll();
912  $countCategories = $queryBuilder
913  ->count('*')
914  ->from('sys_category_record_mm')
915  ->where(
916  $queryBuilder->expr()->andX(
917  $queryBuilder->expr()->eq('uid_foreign', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT)),
918  $queryBuilder->expr()->eq(
919  'tablenames',
920  $queryBuilder->createNamedParameter('tx_blogexample_domain_model_post', \PDO::PARAM_STR)
921  ),
922  $queryBuilder->expr()->eq(
923  'fieldname',
924  $queryBuilder->createNamedParameter('categories', \PDO::PARAM_STR)
925  )
926  )
927  )
928  ->execute()
929  ->fetchColumn(0);
930  $this->assertEquals(4, $countCategories);
931 
933  $postRepository = $this->objectManager->get(PostRepository::class);
934  $post = $postRepository->findByUid(1);
935 
937  $newCategory = $this->objectManager->get(\‪TYPO3\CMS\‪Extbase\Domain\Model\Category::class);
938  $newCategory->setTitle('New Category');
939 
940  $post->addCategory($newCategory);
941 
942  $postRepository->update($post);
943  $this->persistentManager->persistAll();
944 
945  $queryBuilder->resetQueryParts();
946  $countCategories = $queryBuilder
947  ->count('*')
948  ->from('sys_category_record_mm')
949  ->where(
950  $queryBuilder->expr()->andX(
951  $queryBuilder->expr()->eq('uid_foreign', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT)),
952  $queryBuilder->expr()->eq(
953  'tablenames',
954  $queryBuilder->createNamedParameter('tx_blogexample_domain_model_post', \PDO::PARAM_STR)
955  ),
956  $queryBuilder->expr()->eq(
957  'fieldname',
958  $queryBuilder->createNamedParameter('categories', \PDO::PARAM_STR)
959  )
960  )
961  )
962  ->execute()
963  ->fetchColumn(0);
964  $this->assertEquals(5, $countCategories);
965  }
966 
973  {
975  $postRepository = $this->objectManager->get(PostRepository::class);
977  $post = $postRepository->findByUid(1);
978  // Move category down
979  foreach ($post->getCategories() as $category) {
980  $post->removeCategory($category);
981  $post->addCategory($category);
982  break;
983  }
984  $postRepository->update($post);
985  $this->persistentManager->persistAll();
986 
987  // re-fetch Post and Blog
988  $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('sys_category_record_mm');
989  $queryBuilder->getRestrictions()
990  ->removeAll();
991  $newBlogCategoryCount = $queryBuilder
992  ->count('*')
993  ->from('sys_category_record_mm')
994  ->where(
995  $queryBuilder->expr()->andX(
996  $queryBuilder->expr()->eq(
997  'uid_foreign',
998  $queryBuilder->createNamedParameter($this->blog->getUid(), \PDO::PARAM_INT)
999  ),
1000  $queryBuilder->expr()->eq(
1001  'tablenames',
1002  $queryBuilder->createNamedParameter('tx_blogexample_domain_model_post', \PDO::PARAM_STR)
1003  ),
1004  $queryBuilder->expr()->eq(
1005  'fieldname',
1006  $queryBuilder->createNamedParameter('categories', \PDO::PARAM_STR)
1007  )
1008  )
1009  )
1010  ->execute()
1011  ->fetchColumn(0);
1012 
1013  // one category is hidden, so the expected count has to be one less
1014  $newBlogCategoryCount--;
1015  $this->assertEquals($this->blog->getCategories()->count(), $newBlogCategoryCount);
1016  }
1017 
1021  public function ‪distinctDataProvider()
1022  {
1023  return [
1024  'order default' => [
1025  []
1026  ],
1027  'order default, offset 0' => [
1028  [
1029  'offset' => 0
1030  ]
1031  ],
1032  'order default, limit 100' => [
1033  [
1034  'limit' => 100
1035  ]
1036  ],
1037  'order default, offset 0, limit 100' => [
1038  [
1039  'offset' => 0,
1040  'limit' => 100
1041  ]
1042  ],
1043  'order false' => [
1044  [
1045  'order' => false
1046  ]
1047  ],
1048  'order false, offset 0' => [
1049  [
1050  'order' => false,
1051  'offset' => 0
1052  ]
1053  ],
1054  'order false, limit 100' => [
1055  [
1056  'order' => false, 'limit' => 100
1057  ]
1058  ],
1059  'order false, offset 0, limit 100' => [
1060  [
1061  'order' => false,
1062  'offset' => 0,
1063  'limit' => 100
1064  ]
1065  ],
1066  'order uid, offset 0' => [
1067  [
1068  'order' => ['uid' => ‪QueryInterface::ORDER_ASCENDING],
1069  'offset' => 0
1070  ]
1071  ],
1072  'order uid, limit 100' => [
1073  [
1074  'order' => ['uid' => ‪QueryInterface::ORDER_ASCENDING],
1075  'limit' => 100
1076  ]
1077  ],
1078  'order uid, offset 0, limit 100' => [
1079  [
1080  'order' => ['uid' => ‪QueryInterface::ORDER_ASCENDING],
1081  'offset' => 0,
1082  'limit' => 100
1083  ]
1084  ],
1085  ];
1086  }
1087 
1092  protected function ‪applyQueryRequest(QueryInterface $query, array $queryRequest)
1093  {
1094  if (isset($queryRequest['order']) && !$queryRequest['order']) {
1095  $query->setOrderings([]);
1096  } elseif (!empty($queryRequest['order'])) {
1097  $query->setOrderings($queryRequest['order']);
1098  }
1099  if (isset($queryRequest['offset'])) {
1100  $query->setOffset($queryRequest['offset']);
1101  }
1102  if (isset($queryRequest['limit'])) {
1103  $query->setLimit($queryRequest['limit']);
1104  }
1105  }
1106 
1115  public function ‪distinctPersonEntitiesAreFoundByPublisher(array $queryRequest)
1116  {
1117  $query = $this->‪provideFindPostsByPublisherQuery(1);
1118  $this->‪applyQueryRequest($query, $queryRequest);
1119  $posts = $query->execute();
1120  $postCount = $posts->count();
1121 
1122  $postIds = $this->‪resolveEntityIds($posts->toArray());
1123 
1124  $this->assertEquals($this->‪countDistinctIds($postIds), $postCount);
1125  $this->‪assertDistinctIds($postIds);
1126  }
1127 
1136  public function ‪distinctPersonRecordsAreFoundByPublisher(array $queryRequest)
1137  {
1138  $query = $this->‪provideFindPostsByPublisherQuery(1);
1139  $this->‪applyQueryRequest($query, $queryRequest);
1140  $postRecords = $query->execute(true);
1141  $postIds = $this->‪resolveRecordIds($postRecords);
1142 
1143  $this->‪assertDistinctIds($postIds);
1144  }
1145 
1150  protected function ‪provideFindPostsByPublisherQuery(int $publisherId)
1151  {
1152  $postRepository = $this->objectManager->get(PostRepository::class);
1153  $query = $postRepository->createQuery();
1154  $query->‪matching(
1155  $query->logicalOr([
1156  $query->equals('author.uid', $publisherId),
1157  $query->equals('reviewer.uid', $publisherId)
1158  ])
1159  );
1160  return $query;
1161  }
1162 
1171  public function ‪distinctBlogEntitiesAreFoundByPostsSince(array $queryRequest)
1172  {
1173  $query = $this->‪provideFindBlogsByPostsSinceQuery(
1174  new \DateTime('2017-08-01')
1175  );
1176  $this->‪applyQueryRequest($query, $queryRequest);
1177  $blogs = $query->execute();
1178  $blogCount = $blogs->count();
1179 
1180  $blogIds = $this->‪resolveEntityIds($blogs->toArray());
1181 
1182  $this->assertEquals($this->‪countDistinctIds($blogIds), $blogCount);
1183  $this->‪assertDistinctIds($blogIds);
1184  }
1185 
1194  public function ‪distinctBlogRecordsAreFoundByPostsSince(array $queryRequest)
1195  {
1196  $query = $this->‪provideFindBlogsByPostsSinceQuery(
1197  new \DateTime('2017-08-01')
1198  );
1199  $this->‪applyQueryRequest($query, $queryRequest);
1200  $blogRecords = $query->execute(true);
1201  $blogIds = $this->‪resolveRecordIds($blogRecords);
1202 
1203  $this->‪assertDistinctIds($blogIds);
1204  }
1205 
1210  protected function ‪provideFindBlogsByPostsSinceQuery(\DateTime $date)
1211  {
1212  $blogRepository = $this->objectManager->get(BlogRepository::class);
1213  $query = $blogRepository->createQuery();
1214  $query->‪matching(
1215  $query->greaterThanOrEqual('posts.date', $date)
1216  );
1217  return $query;
1218  }
1219 
1228  public function ‪distinctPersonEntitiesAreFoundByTagNameAreFiltered(array $queryRequest)
1229  {
1230  $query = $this->‪provideFindPersonsByTagNameQuery('SharedTag');
1231  $this->‪applyQueryRequest($query, $queryRequest);
1232  $persons = $query->execute();
1233  $personCount = $persons->count();
1234 
1235  $personIds = $this->‪resolveEntityIds($persons->toArray());
1236 
1237  $this->assertEquals($this->‪countDistinctIds($personIds), $personCount);
1238  $this->‪assertDistinctIds($personIds);
1239  }
1240 
1249  public function ‪distinctPersonRecordsAreFoundByTagNameAreFiltered(array $queryRequest)
1250  {
1251  $query = $this->‪provideFindPersonsByTagNameQuery('SharedTag');
1252  $this->‪applyQueryRequest($query, $queryRequest);
1253  $personRecords = $query->execute(true);
1254  $personIds = $this->‪resolveRecordIds($personRecords);
1255 
1256  $this->‪assertDistinctIds($personIds);
1257  }
1258 
1263  protected function ‪provideFindPersonsByTagNameQuery(string $tagName)
1264  {
1265  $personRepository = $this->objectManager->get(PersonRepository::class);
1266  $query = $personRepository->createQuery();
1267  $query->‪matching(
1268  $query->logicalOr([
1269  $query->equals('tags.name', $tagName),
1270  $query->equals('tagsSpecial.name', $tagName)
1271  ])
1272  );
1273  return $query;
1274  }
1275 
1284  public function ‪distinctPostEntitiesAreFoundByAuthorTagNameAreFiltered(array $queryRequest)
1285  {
1286  $query = $this->‪provideFindPostsByAuthorTagName('SharedTag');
1287  $this->‪applyQueryRequest($query, $queryRequest);
1288  $posts = $query->execute();
1289  $postCount = $posts->count();
1290 
1291  $postsIds = $this->‪resolveEntityIds($posts->toArray());
1292 
1293  $this->assertEquals($this->‪countDistinctIds($postsIds), $postCount);
1294  $this->‪assertDistinctIds($postsIds);
1295  }
1296 
1305  public function ‪distinctPostRecordsAreFoundByAuthorTagNameAreFiltered(array $queryRequest)
1306  {
1307  $query = $this->‪provideFindPostsByAuthorTagName('SharedTag');
1308  $this->‪applyQueryRequest($query, $queryRequest);
1309  $postRecords = $query->execute(true);
1310  $postsIds = $this->‪resolveRecordIds($postRecords);
1311 
1312  $this->‪assertDistinctIds($postsIds);
1313  }
1314 
1319  protected function ‪provideFindPostsByAuthorTagName(string $tagName)
1320  {
1321  $postRepository = $this->objectManager->get(PostRepository::class);
1322  $query = $postRepository->createQuery();
1323  $query->‪matching(
1324  $query->logicalOr([
1325  $query->equals('author.tags.name', $tagName),
1326  $query->equals('author.tagsSpecial.name', $tagName)
1327  ])
1328  );
1329  return $query;
1330  }
1331 
1335  protected function ‪updateAndPersistBlog()
1336  {
1338  $blogRepository = $this->objectManager->get(BlogRepository::class);
1339  $blogRepository->update($this->blog);
1340  $this->persistentManager->persistAll();
1341  }
1342 
1347  protected function ‪resolveEntityIds(array $entities)
1348  {
1349  return array_map(
1350  function (AbstractEntity $entity) {
1351  return $entity->getUid();
1352  },
1353  $entities
1354  );
1355  }
1356 
1361  protected function ‪resolveRecordIds(array $records)
1362  {
1363  return array_column($records, 'uid');
1364  }
1365 
1372  protected function ‪countDistinctIds(array $ids)
1373  {
1374  return count(array_unique($ids));
1375  }
1376 
1383  protected function ‪assertDistinctIds(array $ids)
1384  {
1385  $counts = array_count_values($ids);
1386  $this->assertEquals(count($counts), array_sum($counts));
1387  }
1388 }
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\attachTagToPostAtTheEnd
‪attachTagToPostAtTheEnd()
Definition: RelationTest.php:420
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\provideFindBlogsByPostsSinceQuery
‪QueryInterface provideFindBlogsByPostsSinceQuery(\DateTime $date)
Definition: RelationTest.php:1207
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\distinctPersonRecordsAreFoundByTagNameAreFiltered
‪distinctPersonRecordsAreFoundByTagNameAreFiltered(array $queryRequest)
Definition: RelationTest.php:1246
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\provideFindPersonsByTagNameQuery
‪QueryInterface provideFindPersonsByTagNameQuery(string $tagName)
Definition: RelationTest.php:1260
‪ExtbaseTeam\BlogExample\Domain\Repository\BlogRepository
Definition: BlogRepository.php:21
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\moveTagFromEndToTheMiddle
‪moveTagFromEndToTheMiddle()
Definition: RelationTest.php:711
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\mmRelationWithMatchFieldIsResolvedFromForeignSide
‪mmRelationWithMatchFieldIsResolvedFromForeignSide()
Definition: RelationTest.php:890
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\updateAndPersistBlog
‪updateAndPersistBlog()
Definition: RelationTest.php:1332
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\removeMiddleTagFromPost
‪removeMiddleTagFromPost()
Definition: RelationTest.php:632
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\$blog
‪Blog $blog
Definition: RelationTest.php:35
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\removeLastPostFromBlog
‪removeLastPostFromBlog()
Definition: RelationTest.php:140
‪TYPO3\CMS\Extbase\Persistence\QueryInterface
Definition: QueryInterface.php:26
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\resolveRecordIds
‪int[] resolveRecordIds(array $records)
Definition: RelationTest.php:1358
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\applyQueryRequest
‪applyQueryRequest(QueryInterface $query, array $queryRequest)
Definition: RelationTest.php:1089
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\mmRelationWithoutMatchFieldIsResolved
‪mmRelationWithoutMatchFieldIsResolved()
Definition: RelationTest.php:843
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\removeMiddlePostFromBlog
‪removeMiddlePostFromBlog()
Definition: RelationTest.php:293
‪TYPO3
‪ExtbaseTeam\BlogExample\Domain\Repository\PersonRepository
Definition: PersonRepository.php:23
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\movePostFromEndToTheMiddle
‪movePostFromEndToTheMiddle()
Definition: RelationTest.php:343
‪TYPO3\CMS\Extbase\Persistence\QueryInterface\setOrderings
‪TYPO3 CMS Extbase Persistence QueryInterface setOrderings(array $orderings)
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\distinctPersonEntitiesAreFoundByPublisher
‪distinctPersonEntitiesAreFoundByPublisher(array $queryRequest)
Definition: RelationTest.php:1112
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest
Definition: RelationTest.php:32
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\mmRelationWithMatchFieldIsResolvedFromLocalSide
‪mmRelationWithMatchFieldIsResolvedFromLocalSide()
Definition: RelationTest.php:854
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\removeLastTagFromPost
‪removeLastTagFromPost()
Definition: RelationTest.php:474
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\provideFindPostsByAuthorTagName
‪QueryInterface provideFindPostsByAuthorTagName(string $tagName)
Definition: RelationTest.php:1316
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\$persistentManager
‪TYPO3 CMS Extbase Persistence Generic PersistenceManager $persistentManager
Definition: RelationTest.php:39
‪TYPO3\CMS\Extbase\DomainObject\AbstractEntity
Definition: AbstractEntity.php:22
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\$coreExtensionsToLoad
‪$coreExtensionsToLoad
Definition: RelationTest.php:43
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\resolveEntityIds
‪int[] resolveEntityIds(array $entities)
Definition: RelationTest.php:1344
‪TYPO3\CMS\Extbase\Persistence\ObjectStorage
Definition: ObjectStorage.php:26
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\distinctPostEntitiesAreFoundByAuthorTagNameAreFiltered
‪distinctPostEntitiesAreFoundByAuthorTagNameAreFiltered(array $queryRequest)
Definition: RelationTest.php:1281
‪TYPO3\CMS\Extbase\Persistence\QueryInterface\setOffset
‪TYPO3 CMS Extbase Persistence QueryInterface setOffset($offset)
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\distinctBlogEntitiesAreFoundByPostsSince
‪distinctBlogEntitiesAreFoundByPostsSince(array $queryRequest)
Definition: RelationTest.php:1168
‪TYPO3\CMS\Extbase\Persistence\QueryInterface\ORDER_ASCENDING
‪const ORDER_ASCENDING
Definition: QueryInterface.php:95
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\distinctPersonRecordsAreFoundByPublisher
‪distinctPersonRecordsAreFoundByPublisher(array $queryRequest)
Definition: RelationTest.php:1133
‪TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject\getUid
‪int getUid()
Definition: AbstractDomainObject.php:62
‪TYPO3\CMS\Extbase\Persistence\QueryInterface\matching
‪TYPO3 CMS Extbase Persistence QueryInterface matching($constraint)
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\distinctPersonEntitiesAreFoundByTagNameAreFiltered
‪distinctPersonEntitiesAreFoundByTagNameAreFiltered(array $queryRequest)
Definition: RelationTest.php:1225
‪ExtbaseTeam\BlogExample\Domain\Model\Blog
Definition: Blog.php:23
‪ExtbaseTeam\BlogExample\Domain\Model\Post
Definition: Post.php:23
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:45
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\addTagToPostInTheMiddle
‪addTagToPostInTheMiddle()
Definition: RelationTest.php:549
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence
Definition: AddTest.php:2
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\adjustingMmRelationWithTablesnameAndFieldnameFieldDoNotTouchOtherRelations
‪adjustingMmRelationWithTablesnameAndFieldnameFieldDoNotTouchOtherRelations()
Definition: RelationTest.php:969
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\provideFindPostsByPublisherQuery
‪QueryInterface provideFindPostsByPublisherQuery(int $publisherId)
Definition: RelationTest.php:1147
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\distinctBlogRecordsAreFoundByPostsSince
‪distinctBlogRecordsAreFoundByPostsSince(array $queryRequest)
Definition: RelationTest.php:1191
‪TYPO3\CMS\Extbase\Persistence\QueryInterface\setLimit
‪TYPO3 CMS Extbase Persistence QueryInterface setLimit($limit)
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\$testExtensionsToLoad
‪$testExtensionsToLoad
Definition: RelationTest.php:41
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\assertDistinctIds
‪assertDistinctIds(array $ids)
Definition: RelationTest.php:1380
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\addPostToBlogInTheMiddle
‪addPostToBlogInTheMiddle()
Definition: RelationTest.php:217
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\distinctDataProvider
‪array distinctDataProvider()
Definition: RelationTest.php:1018
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction
Definition: DeletedRestriction.php:26
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\setUp
‪setUp()
Definition: RelationTest.php:52
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\attachPostToBlogAtTheEnd
‪attachPostToBlogAtTheEnd()
Definition: RelationTest.php:81
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:44
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\timestampFieldIsUpdatedOnPostSave
‪timestampFieldIsUpdatedOnPostSave()
Definition: RelationTest.php:804
‪ExtbaseTeam\BlogExample\Domain\Repository\PostRepository
Definition: PostRepository.php:27
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\countDistinctIds
‪int countDistinctIds(array $ids)
Definition: RelationTest.php:1369
‪ExtbaseTeam\BlogExample\Domain\Model\Tag
Definition: Tag.php:21
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\mmRelationWithMatchFieldIsCreatedFromLocalSide
‪mmRelationWithMatchFieldIsCreatedFromLocalSide()
Definition: RelationTest.php:904
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\$objectManager
‪TYPO3 CMS Extbase Object ObjectManagerInterface $objectManager
Definition: RelationTest.php:47
‪TYPO3\CMS\Extbase\Tests\Functional\Persistence\RelationTest\distinctPostRecordsAreFoundByAuthorTagNameAreFiltered
‪distinctPostRecordsAreFoundByAuthorTagNameAreFiltered(array $queryRequest)
Definition: RelationTest.php:1302