From 5b3eee80717a7d74feb615d6501879772a8c7fad Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Thu, 19 Jul 2012 23:59:50 +0200 Subject: [PATCH] DDC-1925 - squashing ticket tests into a single file --- .../Tests/Models/DDC1925/DDC1925Product.php | 97 ---------- .../Tests/Models/DDC1925/DDC1925User.php | 56 ------ .../ORM/Functional/Ticket/DDC1925Test.php | 174 +++++++++++++++--- 3 files changed, 151 insertions(+), 176 deletions(-) delete mode 100644 tests/Doctrine/Tests/Models/DDC1925/DDC1925Product.php delete mode 100644 tests/Doctrine/Tests/Models/DDC1925/DDC1925User.php diff --git a/tests/Doctrine/Tests/Models/DDC1925/DDC1925Product.php b/tests/Doctrine/Tests/Models/DDC1925/DDC1925Product.php deleted file mode 100644 index 16ddffa9d..000000000 --- a/tests/Doctrine/Tests/Models/DDC1925/DDC1925Product.php +++ /dev/null @@ -1,97 +0,0 @@ -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 DDC1925User $buyer - */ - public function addBuyer(DDC1925User $buyer) - { - $this->buyers[] = $buyer; - } -} \ No newline at end of file diff --git a/tests/Doctrine/Tests/Models/DDC1925/DDC1925User.php b/tests/Doctrine/Tests/Models/DDC1925/DDC1925User.php deleted file mode 100644 index abbdddaa1..000000000 --- a/tests/Doctrine/Tests/Models/DDC1925/DDC1925User.php +++ /dev/null @@ -1,56 +0,0 @@ -id; - } - - /** - * Set title - * - * @param string $title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * Get title - * - * @return string - */ - public function getTitle() - { - return $this->title; - } -} diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1925Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1925Test.php index d6c0bf133..869da8322 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1925Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1925Test.php @@ -2,39 +2,23 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use Doctrine\Tests\Models\ECommerce\ECommerceShipping; -use Doctrine\Tests\Models\DDC1925\DDC1925User; -use Doctrine\Tests\Models\DDC1925\DDC1925Product; +use Doctrine\Common\Collections\ArrayCollection; require_once __DIR__ . '/../../../TestInit.php'; /** * @group DDC-1925 + * @group DDC-1210 */ class DDC1925Test extends \Doctrine\Tests\OrmFunctionalTestCase { - - /** - * @var \Doctrine\Tests\Models\Quote\User - */ - private $email; - - protected function setUp() - { - parent::setUp(); - - //try { - $this->_schemaTool->createSchema(array( - $this->_em->getClassMetadata('Doctrine\Tests\Models\DDC1925\DDC1925User'), - $this->_em->getClassMetadata('Doctrine\Tests\Models\DDC1925\DDC1925Product'), - )); - //} catch(\Exception $e) { - //} - - } - public function testIssue() { + $this->_schemaTool->createSchema(array( + $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1925User'), + $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1925Product'), + )); + $user = new DDC1925User(); $user->setTitle("Test User"); $this->_em->persist($user); @@ -51,4 +35,148 @@ class DDC1925Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->persist($product); $this->_em->flush(); } +} + +/** + * @Table + * @Entity + */ +class DDC1925Product +{ + /** + * @var integer $id + * + * @Column(name="id", type="integer") + * @Id + * @GeneratedValue(strategy="AUTO") + */ + private $id; + + /** + * @var string $title + * + * @Column(name="title", type="string", length=255) + */ + private $title; + + /** + * @ManyToMany(targetEntity="DDC1925User") + * @JoinTable( + * name="user_purchases", + * joinColumns={@JoinColumn(name="product_id", referencedColumnName="id")}, + * inverseJoinColumns={@JoinColumn(name="user_id", referencedColumnName="id")} + * ) + */ + private $buyers; + + /** + * Default constructor + */ + public function __construct() + { + $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 DDC1925User $buyer + */ + public function addBuyer(DDC1925User $buyer) + { + $this->buyers[] = $buyer; + } +} + +/** + * @Table + * @Entity + */ +class DDC1925User +{ + /** + * @var integer + * + * @Column(name="id", type="integer") + * @Id + * @GeneratedValue(strategy="AUTO") + */ + private $id; + + /** + * @var string + * + * @Column(name="title", type="string", length=255) + */ + private $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; + } } \ No newline at end of file