3 namespace Doctrine\Tests\ORM\Functional;
5 use Doctrine\ORM\Tools\SchemaValidator;
8 * Test the validity of all modelsets
12 class SchemaValidatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
14 static public function dataValidateModelSets()
17 foreach (self::$_modelSets as $modelSet => $classes) {
18 if ($modelSet == "customtype") {
21 $modelSets[] = array($modelSet);
27 * @dataProvider dataValidateModelSets
29 public function testValidateModelSets($modelSet)
31 $validator = new SchemaValidator($this->_em);
34 foreach (self::$_modelSets[$modelSet] as $className) {
35 $classes[] = $this->_em->getClassMetadata($className);
38 foreach ($classes as $class) {
39 $ce = $validator->validateClass($class);
41 foreach ($ce as $key => $error) {
42 if (strpos($error, "must be private or protected. Public fields may break lazy-loading.") !== false) {
47 $this->assertEquals(0, count($ce), "Invalid Modelset: " . $modelSet . " class " . $class->name . ": ". implode("\n", $ce));