Basic commit
Added meta data files (gitattribute to normalize line ending, gitignore), as well as a simple Model and non-working tests.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace LotGD\Core\Tests;
|
||||
|
||||
use Doctrine\Common\Annotations\AnnotationReader;
|
||||
use Doctrine\ORM\{
|
||||
EntityManager,
|
||||
Tools\Setup,
|
||||
Tools\SchemaTool
|
||||
};
|
||||
use Doctrine\ORM\Mapping\{
|
||||
ClassMetadata,
|
||||
Driver\DriverChain,
|
||||
Driver\AnnotationDriver
|
||||
};
|
||||
|
||||
/**
|
||||
* Description of ModelTestCase
|
||||
*/
|
||||
abstract class ModelTestCase extends \PHPUnit_Framework_TestCase {
|
||||
/** @var array */
|
||||
protected $entities = [];
|
||||
/** @var Doctrine\ORM\EntityManager */
|
||||
protected $_em;
|
||||
|
||||
/**
|
||||
* Sets up the database and database structure
|
||||
*/
|
||||
protected function setUp() {
|
||||
$configuration = Setup::createAnnotationMetadataConfiguration(["src/Models"], true);
|
||||
|
||||
$this->_em = EntityManager::create(["url" => "sqlite:///:memory:"], $configuration);
|
||||
|
||||
// Create Schema
|
||||
$schemaTool = new SchemaTool($this->_em);
|
||||
|
||||
$metaClasses = [];
|
||||
foreach($this->entities as $entity) {
|
||||
$metaClasses[] = new ClassMetadata($entity);
|
||||
}
|
||||
|
||||
var_dump($metaClasses[0]);
|
||||
|
||||
$schemaTool->createSchema($metaClasses);
|
||||
}
|
||||
|
||||
protected function getEntityManager() {
|
||||
return $this->_em;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user