diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6029Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6029Test.php index 6002450e3a8..6a87644b458 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6029Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6029Test.php @@ -3,9 +3,12 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\ORM\Mapping as ORM; +use Doctrine\ORM\ORMInvalidArgumentException; use Doctrine\Tests\OrmFunctionalTestCase; +/** + * @group DDC-6029 + */ class DDC6029Test extends OrmFunctionalTestCase { /** @@ -31,6 +34,9 @@ public function testIssue() $user = new DDC6029User(); $user->addGroup(new DDC6029Group2()); + self::expectException(ORMInvalidArgumentException::class); + self::expectExceptionMessage('Expected value of type "Doctrine\Tests\ORM\Functional\Ticket\DDC6029Group" for association field "Doctrine\Tests\ORM\Functional\Ticket\DDC6029User#$groups", got "Doctrine\Tests\ORM\Functional\Ticket\DDC6029Group2" instead.'); + $this->_em->persist($user); $this->_em->flush(); } @@ -42,7 +48,7 @@ class DDC6029User /** @Id @Column(type="integer") @GeneratedValue */ public $id; - /** @ManyToMany(targetEntity="DDC6029Group", inversedBy="users", cascade={"all"}) */ + /** @ManyToMany(targetEntity="DDC6029Group", cascade={"all"}) */ private $groups; public function __construct() { @@ -63,16 +69,6 @@ class DDC6029Group implements DDC6029GroupInterface { /** @Id @Column(type="integer") @GeneratedValue */ public $id; - - /** - * @ManyToMany(targetEntity="DDC6029User", mappedBy="groups") - */ - private $users; - - public function __construct() - { - $this->users = new ArrayCollection(); - } } /** @Entity */