From f181cf6c6b1aef0daaae37e2d13aadc924cd47c2 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sun, 19 Jun 2016 12:42:49 +0200 Subject: [PATCH] #5867 simplifying test case by inlining all required models into the test case --- .../Tests/Models/DDC3303/DDC3303Address.php | 60 ---------------- .../Tests/Models/DDC3303/DDC3303Employee.php | 39 ----------- .../Tests/Models/DDC3303/DDC3303Person.php | 61 ----------------- .../ORM/Functional/Ticket/DDC3303Test.php | 68 ++++++++++++++++--- 4 files changed, 60 insertions(+), 168 deletions(-) delete mode 100644 tests/Doctrine/Tests/Models/DDC3303/DDC3303Address.php delete mode 100644 tests/Doctrine/Tests/Models/DDC3303/DDC3303Employee.php delete mode 100644 tests/Doctrine/Tests/Models/DDC3303/DDC3303Person.php diff --git a/tests/Doctrine/Tests/Models/DDC3303/DDC3303Address.php b/tests/Doctrine/Tests/Models/DDC3303/DDC3303Address.php deleted file mode 100644 index c3b634abf..000000000 --- a/tests/Doctrine/Tests/Models/DDC3303/DDC3303Address.php +++ /dev/null @@ -1,60 +0,0 @@ -street = $street; - $this->number = $number; - $this->city = $city; - } - - /** - * @return string - */ - public function getStreet() - { - return $this->street; - } - - /** - * @return mixed - */ - public function getNumber() - { - return $this->number; - } - - /** - * @return string - */ - public function getCity() - { - return $this->city; - } -} diff --git a/tests/Doctrine/Tests/Models/DDC3303/DDC3303Employee.php b/tests/Doctrine/Tests/Models/DDC3303/DDC3303Employee.php deleted file mode 100644 index 334dc2052..000000000 --- a/tests/Doctrine/Tests/Models/DDC3303/DDC3303Employee.php +++ /dev/null @@ -1,39 +0,0 @@ -company = $company; - } - - /** - * @return string - */ - public function getCompany() - { - return $this->company; - } - - /** - * @param string $company - */ - public function setCompany($company) - { - $this->company = $company; - } -} diff --git a/tests/Doctrine/Tests/Models/DDC3303/DDC3303Person.php b/tests/Doctrine/Tests/Models/DDC3303/DDC3303Person.php deleted file mode 100644 index da42d1c54..000000000 --- a/tests/Doctrine/Tests/Models/DDC3303/DDC3303Person.php +++ /dev/null @@ -1,61 +0,0 @@ -name = $name; - $this->address = $address; - } - - /** - * @return int - */ - public function getId() - { - return $this->id; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @return DDC3303Address - */ - public function getAddress() - { - return $this->address; - } -} diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php index e6415d393..b122d9df6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php @@ -1,18 +1,15 @@ _schemaTool->createSchema(array($this->_em->getClassMetadata(DDC3303Employee::class))); + parent::setUp(); + + $this->_schemaTool->createSchema([$this->_em->getClassMetadata(DDC3303Employee::class)]); } public function testEmbeddedObjectsAreAlsoInherited() @@ -27,6 +24,61 @@ class DDC3303Test extends OrmFunctionalTestCase $this->_em->flush(); $this->_em->clear(); - $this->assertEquals($employee, $this->_em->find(DDC3303Employee::class, 1)); + self::assertEquals($employee, $this->_em->find(DDC3303Employee::class, 'John Doe')); + } +} + +/** @MappedSuperclass */ +abstract class DDC3303Person +{ + /** @Id @GeneratedValue(strategy="NONE") @Column(type="string") @var string */ + private $name; + + /** @Embedded(class="DDC3303Address") @var DDC3303Address */ + private $address; + + public function __construct($name, DDC3303Address $address) + { + $this->name = $name; + $this->address = $address; + } +} + +/** + * @Embeddable + */ +class DDC3303Address +{ + /** @Column(type="string") @var string */ + private $street; + + /** @Column(type="integer") @var int */ + private $number; + + /** @Column(type="string") @var string */ + private $city; + + public function __construct($street, $number, $city) + { + $this->street = $street; + $this->number = $number; + $this->city = $city; + } +} + +/** + * @Entity + * @Table(name="ddc3303_employee") + */ +class DDC3303Employee extends DDC3303Person +{ + /** @Column(type="string") @var string */ + private $company; + + public function __construct($name, DDC3303Address $address, $company) + { + parent::__construct($name, $address); + + $this->company = $company; } }