Update test according to @Ocramius notes
This commit is contained in:
parent
e36c7b0c2a
commit
981cebbf4c
@ -8,6 +8,7 @@ namespace Doctrine\Tests\Models\DDC3346;
|
||||
*/
|
||||
class DDC3346Article
|
||||
{
|
||||
const CLASSNAME = 'Doctrine\Tests\Models\DDC3346\DDC3346Article';
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
@ -19,10 +20,6 @@ class DDC3346Article
|
||||
* @JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*/
|
||||
public $user;
|
||||
/**
|
||||
* @Column(type="text")
|
||||
*/
|
||||
public $text;
|
||||
|
||||
public function setAuthor(DDC3346Author $author)
|
||||
{
|
||||
|
@ -8,23 +8,16 @@ namespace Doctrine\Tests\Models\DDC3346;
|
||||
*/
|
||||
class DDC3346Author
|
||||
{
|
||||
const CLASSNAME = 'Doctrine\Tests\Models\DDC3346\DDC3346Author';
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
public $status;
|
||||
/**
|
||||
* @Column(type="string", length=255, unique=true)
|
||||
*/
|
||||
public $username;
|
||||
/**
|
||||
* @Column(type="string", length=255)
|
||||
*/
|
||||
public $name;
|
||||
/**
|
||||
* @OneToMany(targetEntity="DDC3346Article", mappedBy="user", fetch="EAGER", cascade={"detach"})
|
||||
*/
|
||||
|
@ -16,8 +16,8 @@ class DDC3346Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
|
||||
$this->setUpEntitySchema(
|
||||
array(
|
||||
'Doctrine\Tests\Models\DDC3346\DDC3346Article',
|
||||
'Doctrine\Tests\Models\DDC3346\DDC3346Author',
|
||||
DDC3346Author::CLASSNAME,
|
||||
DDC3346Article::CLASSNAME,
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -25,16 +25,12 @@ class DDC3346Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
public function testFindOneByWithEagerFetch()
|
||||
{
|
||||
$user = new DDC3346Author();
|
||||
$user->name = "Buggy Woogy";
|
||||
$user->username = "bwoogy";
|
||||
$user->status = "active";
|
||||
|
||||
$article1 = new DDC3346Article();
|
||||
$article1->text = "First content";
|
||||
$article1->setAuthor($user);
|
||||
|
||||
$article2 = new DDC3346Article();
|
||||
$article2->text = "Second content";
|
||||
$article2->setAuthor($user);
|
||||
|
||||
$this->_em->persist($user);
|
||||
|
Loading…
x
Reference in New Issue
Block a user