Skip to content

Commit

Permalink
Assert expected exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
foaly-nr1 committed Oct 30, 2017
1 parent b81ad4e commit 409090e
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6029Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/**
Expand All @@ -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();
}
Expand All @@ -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() {
Expand All @@ -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 */
Expand Down

0 comments on commit 409090e

Please sign in to comment.