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