#5867 simplifying test case by inlining all required models into the test case
This commit is contained in:
parent
62431ae477
commit
f181cf6c6b
@ -1,60 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Doctrine\Tests\Models\DDC3303;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getStreet()
|
|
||||||
{
|
|
||||||
return $this->street;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getNumber()
|
|
||||||
{
|
|
||||||
return $this->number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCity()
|
|
||||||
{
|
|
||||||
return $this->city;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Doctrine\Tests\Models\DDC3303;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCompany()
|
|
||||||
{
|
|
||||||
return $this->company;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $company
|
|
||||||
*/
|
|
||||||
public function setCompany($company)
|
|
||||||
{
|
|
||||||
$this->company = $company;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Doctrine\Tests\Models\DDC3303;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @MappedSuperclass
|
|
||||||
*/
|
|
||||||
abstract class DDC3303Person
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @Id
|
|
||||||
* @Column(type="integer")
|
|
||||||
* @GeneratedValue(strategy="AUTO")
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DDC3303Address
|
|
||||||
*/
|
|
||||||
public function getAddress()
|
|
||||||
{
|
|
||||||
return $this->address;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Doctrine\Tests\ORM\Functional\Ticket;
|
namespace Doctrine\Tests\ORM\Functional\Ticket;
|
||||||
|
|
||||||
use Doctrine\Tests\Models\DDC3303\DDC3303Address;
|
|
||||||
use Doctrine\Tests\Models\DDC3303\DDC3303Employee;
|
|
||||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||||
|
|
||||||
class DDC3303Test extends OrmFunctionalTestCase
|
class DDC3303Test extends OrmFunctionalTestCase
|
||||||
{
|
{
|
||||||
/**
|
protected function setUp()
|
||||||
* @before
|
|
||||||
*/
|
|
||||||
public function createSchema()
|
|
||||||
{
|
{
|
||||||
$this->_schemaTool->createSchema(array($this->_em->getClassMetadata(DDC3303Employee::class)));
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->_schemaTool->createSchema([$this->_em->getClassMetadata(DDC3303Employee::class)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEmbeddedObjectsAreAlsoInherited()
|
public function testEmbeddedObjectsAreAlsoInherited()
|
||||||
@ -27,6 +24,61 @@ class DDC3303Test extends OrmFunctionalTestCase
|
|||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
$this->_em->clear();
|
$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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user