Created
April 22, 2013 11:48
-
-
Save Ocramius/5434209 to your computer and use it in GitHub Desktop.
Functional test case for schema validation in Doctrine2 ORM
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
<?php | |
namespace Ocramius\CMS\ContentTest; | |
use Ocramius\CMS\ContentTest\Util\ServiceManagerFactory; | |
use Doctrine\ORM\Tools\SchemaTool; | |
use Doctrine\ORM\Tools\SchemaValidator; | |
use PHPUnit_Framework_TestCase; | |
/** | |
* Tests to verify that the schema is valid | |
* | |
* @author Marco Pivetta <[email protected]> | |
*/ | |
class SchemaValidityFunctionalTest extends PHPUnit_Framework_TestCase | |
{ | |
public function testCanGenerateValidDatabase() | |
{ | |
$serviceManager = ServiceManagerFactory::getServiceManager(); | |
/* @var $entityManager \Doctrine\ORM\EntityManager */ | |
$entityManager = $serviceManager->get('Doctrine\ORM\EntityManager'); | |
$schemaTool = new SchemaTool($entityManager); | |
$validator = new SchemaValidator($entityManager); | |
$this->assertSame(array(), $validator->validateMapping(), 'Schema has valid mappings'); | |
$schemaTool->createSchema($entityManager->getMetadataFactory()->getAllMetadata()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment