@@ 852-866 (lines=15) @@ | ||
849 | $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount()); |
|
850 | } |
|
851 | ||
852 | public function testContainsKeyIndexByOneToManyJoinedInheritance() |
|
853 | { |
|
854 | $class = $this->_em->getClassMetadata(DDC2504OtherClass::class); |
|
855 | $class->associationMappings['childClasses']['indexBy'] = 'id'; |
|
856 | ||
857 | $otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId); |
|
858 | ||
859 | $queryCount = $this->getCurrentQueryCount(); |
|
860 | ||
861 | $contains = $otherClass->childClasses->containsKey($this->ddc2504ChildClassId); |
|
862 | ||
863 | $this->assertTrue($contains); |
|
864 | $this->assertFalse($otherClass->childClasses->isInitialized()); |
|
865 | $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount()); |
|
866 | } |
|
867 | ||
868 | public function testContainsKeyIndexByManyToMany() |
|
869 | { |
|
@@ 868-881 (lines=14) @@ | ||
865 | $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount()); |
|
866 | } |
|
867 | ||
868 | public function testContainsKeyIndexByManyToMany() |
|
869 | { |
|
870 | $user = $this->_em->find(CmsUser::class, $this->userId2); |
|
871 | ||
872 | $group = $this->_em->find(CmsGroup::class, $this->groupId); |
|
873 | ||
874 | $queryCount = $this->getCurrentQueryCount(); |
|
875 | ||
876 | $contains = $user->groups->containsKey($group->name); |
|
877 | ||
878 | $this->assertTrue($contains, "The item is not into collection"); |
|
879 | $this->assertFalse($user->groups->isInitialized(), "The collection must not be initialized"); |
|
880 | $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount()); |
|
881 | } |
|
882 | public function testContainsKeyIndexByManyToManyNonOwning() |
|
883 | { |
|
884 | $user = $this->_em->find(CmsUser::class, $this->userId2); |
|
@@ 882-894 (lines=13) @@ | ||
879 | $this->assertFalse($user->groups->isInitialized(), "The collection must not be initialized"); |
|
880 | $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount()); |
|
881 | } |
|
882 | public function testContainsKeyIndexByManyToManyNonOwning() |
|
883 | { |
|
884 | $user = $this->_em->find(CmsUser::class, $this->userId2); |
|
885 | $group = $this->_em->find(CmsGroup::class, $this->groupId); |
|
886 | ||
887 | $queryCount = $this->getCurrentQueryCount(); |
|
888 | ||
889 | $contains = $group->users->containsKey($user->username); |
|
890 | ||
891 | $this->assertTrue($contains, "The item is not into collection"); |
|
892 | $this->assertFalse($group->users->isInitialized(), "The collection must not be initialized"); |
|
893 | $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount()); |
|
894 | } |
|
895 | ||
896 | public function testContainsKeyIndexByWithPkManyToMany() |
|
897 | { |
|
@@ 896-910 (lines=15) @@ | ||
893 | $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount()); |
|
894 | } |
|
895 | ||
896 | public function testContainsKeyIndexByWithPkManyToMany() |
|
897 | { |
|
898 | $class = $this->_em->getClassMetadata(CmsUser::class); |
|
899 | $class->associationMappings['groups']['indexBy'] = 'id'; |
|
900 | ||
901 | $user = $this->_em->find(CmsUser::class, $this->userId2); |
|
902 | ||
903 | $queryCount = $this->getCurrentQueryCount(); |
|
904 | ||
905 | $contains = $user->groups->containsKey($this->groupId); |
|
906 | ||
907 | $this->assertTrue($contains, "The item is not into collection"); |
|
908 | $this->assertFalse($user->groups->isInitialized(), "The collection must not be initialized"); |
|
909 | $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount()); |
|
910 | } |
|
911 | public function testContainsKeyIndexByWithPkManyToManyNonOwning() |
|
912 | { |
|
913 | $class = $this->_em->getClassMetadata(CmsGroup::class); |
|
@@ 911-925 (lines=15) @@ | ||
908 | $this->assertFalse($user->groups->isInitialized(), "The collection must not be initialized"); |
|
909 | $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount()); |
|
910 | } |
|
911 | public function testContainsKeyIndexByWithPkManyToManyNonOwning() |
|
912 | { |
|
913 | $class = $this->_em->getClassMetadata(CmsGroup::class); |
|
914 | $class->associationMappings['users']['indexBy'] = 'id'; |
|
915 | ||
916 | $group = $this->_em->find(CmsGroup::class, $this->groupId); |
|
917 | ||
918 | $queryCount = $this->getCurrentQueryCount(); |
|
919 | ||
920 | $contains = $group->users->containsKey($this->userId2); |
|
921 | ||
922 | $this->assertTrue($contains, "The item is not into collection"); |
|
923 | $this->assertFalse($group->users->isInitialized(), "The collection must not be initialized"); |
|
924 | $this->assertEquals($queryCount + 1, $this->getCurrentQueryCount()); |
|
925 | } |
|
926 | ||
927 | public function testContainsKeyNonExistentIndexByOneToMany() |
|
928 | { |