1
0
mirror of synced 2025-01-09 18:47:10 +03:00

Update DDC3033Test.php

This commit is contained in:
Thomas Lallement 2014-03-18 22:10:15 +01:00
parent 7bf2bcb017
commit 6bbc07ddbf

View File

@ -20,22 +20,22 @@ class DDC3033Test extends \Doctrine\Tests\OrmFunctionalTestCase
)); ));
$user = new DDC3033User(); $user = new DDC3033User();
$user->setTitle("Test User"); $user->title = "Test User";
$this->_em->persist($user); $this->_em->persist($user);
$user2 = new DDC3033User(); $user2 = new DDC3033User();
$user2->setTitle("Test User 2"); $user2->title = "Test User 2";
$this->_em->persist($user2); $this->_em->persist($user2);
$product = new DDC3033Product(); $product = new DDC3033Product();
$product->setTitle("Test product"); $product->title = "Test product";
$product->addBuyer($user); $product->buyers[] = $user;
$this->_em->persist($product); $this->_em->persist($product);
$this->_em->flush(); $this->_em->flush();
$product->setTitle("Test Change title"); $product->title = "Test Change title";
$product->addBuyer($user2); $product->buyers[] = $user2;
$this->_em->persist($product); $this->_em->persist($product);
$this->_em->flush(); $this->_em->flush();
@ -47,7 +47,7 @@ class DDC3033Test extends \Doctrine\Tests\OrmFunctionalTestCase
), ),
); );
$this->assertEquals(print_r($expect, true), print_r($product->changeSet, true)); $this->assertEquals($expect, $product->changeSet);
} }
} }
@ -66,24 +66,24 @@ class DDC3033Product
* @Id * @Id
* @GeneratedValue(strategy="AUTO") * @GeneratedValue(strategy="AUTO")
*/ */
private $id; public $id;
/** /**
* @var string $title * @var string $title
* *
* @Column(name="title", type="string", length=255) * @Column(name="title", type="string", length=255)
*/ */
private $title; public $title;
/** /**
* @ManyToMany(targetEntity="DDC3033User") * @ManyToMany(targetEntity="DDC3033User")
* @JoinTable( * @JoinTable(
* name="user_purchases", * name="user_purchases_3033",
* joinColumns={@JoinColumn(name="product_id", referencedColumnName="id")}, * joinColumns={@JoinColumn(name="product_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="user_id", referencedColumnName="id")} * inverseJoinColumns={@JoinColumn(name="user_id", referencedColumnName="id")}
* ) * )
*/ */
private $buyers; public $buyers;
/** /**
* Default constructor * Default constructor
@ -93,56 +93,6 @@ class DDC3033Product
$this->buyers = new ArrayCollection(); $this->buyers = new ArrayCollection();
} }
/**
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $buyers
*/
public function setBuyers($buyers)
{
$this->buyers = $buyers;
}
/**
* @return string
*/
public function getBuyers()
{
return $this->buyers;
}
/**
* @param DDC3033User $buyer
*/
public function addBuyer(DDC3033User $buyer)
{
$this->buyers[] = $buyer;
}
/** /**
* @PreUpdate * @PreUpdate
*/ */
@ -178,42 +128,12 @@ class DDC3033User
* @Id * @Id
* @GeneratedValue(strategy="AUTO") * @GeneratedValue(strategy="AUTO")
*/ */
private $id; public $id;
/** /**
* @var string * @var string
* *
* @Column(name="title", type="string", length=255) * @Column(name="title", type="string", length=255)
*/ */
private $title; public $title;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
} }