-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename getProxyDirectory and allow to set it
add a little acceptance/functional test
- Loading branch information
Showing
5 changed files
with
174 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Webforge\Doctrine\Test; | ||
|
||
use Webforge\Doctrine\Util; | ||
|
||
/** | ||
* A testcase that requires that the schema for the entities is used | ||
*/ | ||
class SchemaTestCase extends Base { | ||
|
||
public static $schemaCreated = FALSE; | ||
|
||
public function setUp() { | ||
parent::setUp(); | ||
|
||
$this->dcc->initDoctrine( | ||
$this->frameworkHelper->getBootContainer()->getProject()->getConfiguration()->get(array('db')), | ||
$this->entitiesPaths = array($this->getTestDirectory('Entities/')) | ||
); | ||
|
||
if (!self::$schemaCreated) { | ||
$this->dcc->getUtil()->updateSchema('tests', Util::FORCE, $eol = "\n"); | ||
|
||
self::$schemaCreated = TRUE; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Webforge\Doctrine; | ||
|
||
use Doctrine\Tests\Models\Company\CompanyCar; | ||
|
||
class ContainerEntitiesTest extends \Webforge\Doctrine\Test\SchemaTestCase { | ||
|
||
protected $container; | ||
|
||
public function setUp() { | ||
$this->chainClass = 'Webforge\\Doctrine\\Container'; | ||
parent::setUp(); | ||
|
||
$this->em = $this->dcc->getEntityManager('tests'); | ||
} | ||
|
||
public function testEntityManagerFIndsTheEntyLoadedFromTestFiles() { | ||
$this->assertNull($this->em->find('Doctrine\Tests\Models\Company\CompanyCar', 1)); | ||
|
||
$car = new CompanyCar('Ford'); | ||
$this->em->persist($car); | ||
$this->em->flush(); | ||
$this->em->clear(); | ||
|
||
$this->assertInstanceOf( | ||
'Doctrine\Tests\Models\Company\CompanyCar', | ||
$this->em->find('Doctrine\Tests\Models\Company\CompanyCar', 1) | ||
); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
tests/files/Entities/Doctrine/Tests/Models/Company/CompanyCar.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\Models\Company; | ||
|
||
/** | ||
* @Entity | ||
* @Table(name="company_cars") | ||
*/ | ||
class CompanyCar | ||
{ | ||
/** | ||
* @Id @Column(type="integer") | ||
* @GeneratedValue(strategy="AUTO") | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @Column(type="string", length=50) | ||
*/ | ||
private $brand; | ||
|
||
public function __construct($brand = null) { | ||
$this->brand = $brand; | ||
} | ||
|
||
public function getId() { | ||
return $this->id; | ||
} | ||
|
||
public function getBrand() { | ||
return $this->title; | ||
} | ||
} |