@@ 1172-1192 (lines=21) @@ | ||
1169 | /** |
|
1170 | * @group DDC-720 |
|
1171 | */ |
|
1172 | public function testFlushSingleAndNoCascade() |
|
1173 | { |
|
1174 | $user = new CmsUser; |
|
1175 | $user->name = 'Dominik'; |
|
1176 | $user->username = 'domnikl'; |
|
1177 | $user->status = 'developer'; |
|
1178 | ||
1179 | $this->_em->persist($user); |
|
1180 | $this->_em->flush(); |
|
1181 | ||
1182 | $article1 = new CmsArticle(); |
|
1183 | $article1->topic = 'Foo'; |
|
1184 | $article1->text = 'Foo Text'; |
|
1185 | $article1->author = $user; |
|
1186 | $user->articles[] = $article1; |
|
1187 | ||
1188 | $this->expectException(\InvalidArgumentException::class); |
|
1189 | $this->expectExceptionMessage("A new entity was found through the relationship 'Doctrine\Tests\Models\CMS\CmsUser#articles'"); |
|
1190 | ||
1191 | $this->_em->flush($user); |
|
1192 | } |
|
1193 | ||
1194 | /** |
|
1195 | * @group DDC-720 |
@@ 515-535 (lines=21) @@ | ||
512 | /** |
|
513 | * @group DDC-991 |
|
514 | */ |
|
515 | public function testgetOneOrNullResultSeveralRows() |
|
516 | { |
|
517 | $user = new CmsUser; |
|
518 | $user->name = 'Guilherme'; |
|
519 | $user->username = 'gblanco'; |
|
520 | $user->status = 'developer'; |
|
521 | $this->_em->persist($user); |
|
522 | $user = new CmsUser; |
|
523 | $user->name = 'Roman'; |
|
524 | $user->username = 'romanb'; |
|
525 | $user->status = 'developer'; |
|
526 | $this->_em->persist($user); |
|
527 | $this->_em->flush(); |
|
528 | $this->_em->clear(); |
|
529 | ||
530 | $query = $this->_em->createQuery("select u from Doctrine\Tests\Models\CMS\CmsUser u"); |
|
531 | ||
532 | $this->expectException(NonUniqueResultException::class); |
|
533 | ||
534 | $fetchedUser = $query->getOneOrNullResult(); |
|
535 | } |
|
536 | ||
537 | /** |
|
538 | * @group DDC-991 |