1
0
mirror of synced 2024-12-14 07:06:04 +03:00

moved test entities from sandbox

This commit is contained in:
Adam Prager 2013-04-07 16:26:05 +02:00
parent 3b7b457d35
commit b7b107b08a
5 changed files with 58 additions and 14 deletions

View File

@ -0,0 +1,45 @@
<?php
namespace Doctrine\Tests\Models\DDC2372;
/** @Entity @Table(name="addresses") */
class DDC2372Address
{
/**
* @Id @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
private $id;
/** @Column(type="string", length=255) */
private $street;
/** @OneToOne(targetEntity="User", mappedBy="address") */
private $user;
public function getId()
{
return $this->id;
}
public function getStreet()
{
return $this->street;
}
public function setStreet($street)
{
$this->street = $street;
}
public function getUser()
{
return $this->user;
}
public function setUser(User $user)
{
if ($this->user !== $user) {
$this->user = $user;
$user->setAddress($this);
}
}
}

View File

@ -1,13 +1,13 @@
<?php
namespace Entities;
namespace Doctrine\Tests\Models\DDC2372;
use Entities\Traits\AddressTrait;
use Doctrine\Tests\Models\DDC2372\Traits\DDC2372AddressTrait;
/** @Entity @Table(name="traited_users") */
class TraitedUser
/** @Entity @Table(name="users") */
class DDC2372User
{
use AddressTrait;
use DDC2372AddressTrait;
/**
* @Id @Column(type="integer")

View File

@ -1,11 +1,11 @@
<?php
namespace Entities\Traits;
namespace Doctrine\Tests\Models\DDC2372\Traits;
trait AddressTrait
trait DDC2372AddressTrait
{
/**
* @OneToOne(targetEntity="Entities\Address", inversedBy="user")
* @OneToOne(targetEntity="Doctrine\Tests\Models\DDC2372\DDC2372Address", inversedBy="user")
* @JoinColumn(name="address_id", referencedColumnName="id")
*/
private $address;

View File

@ -7,7 +7,7 @@ use Doctrine\ORM\Tools\EntityGenerator;
use Doctrine\ORM\Tools\Export\ClassMetadataExporter;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadataFactory;
use Entities\TraitedUser;
use Doctrine\Tests\Models\DDC2372\DDC2372User;
require_once __DIR__ . '/../../TestInit.php';
@ -463,15 +463,15 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase
$em = $this->_getTestEntityManager();
$cmf->setEntityManager($em);
$user = new TraitedUser();
$user = new DDC2372User();
$metadata = $cmf->getMetadataFor(get_class($user));
$metadata->name = $this->_namespace . "\TraitedUser";
$metadata->name = $this->_namespace . "\DDC2372User";
$metadata->namespace = $this->_namespace;
$this->_generator->writeEntityClass($metadata, $this->_tmpDir);
$this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/TraitedUser.php");
require $this->_tmpDir . "/" . $this->_namespace . "/TraitedUser.php";
$this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/DDC2372User.php");
require $this->_tmpDir . "/" . $this->_namespace . "/DDC2372User.php";
$reflClass = new \ReflectionClass($metadata->name);

View File

@ -17,7 +17,6 @@ if (file_exists(__DIR__ . '/../../../vendor/autoload.php')) {
}
/* @var $classLoader \Composer\Autoload\ClassLoader */
$classLoader->add('Entities', __DIR__ . '/../../../tools/sandbox');
$classLoader->add('Doctrine\\Tests\\', __DIR__ . '/../../');
unset($classLoader);