1
0
mirror of synced 2025-02-20 22:23:14 +03:00

Update test according to @Ocramius notes

This commit is contained in:
Pavel Batanov 2015-01-22 18:31:15 +03:00 committed by Marco Pivetta
parent e36c7b0c2a
commit 981cebbf4c
3 changed files with 4 additions and 18 deletions

View File

@ -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)
{

View File

@ -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"})
*/

View File

@ -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);