/** * @test */ public function getClass_returns_instance() { $dm = $this->dm; $st = new SchemaTool($dm); $schema = $st->getSchemaFromMetadata([$dm->getClassMetadata(CmsUser::class)]); $class = $schema->getClass('CmsUser'); $this->assertInstanceOf(OClass::class, $class); return $class; }
/** * Creates a connection to the test database, if there is none yet, and * creates the necessary tables. */ protected function setUp() { if (!$this->dm) { $this->dm = $this->createDocumentManager(['binding' => self::$_b]); $this->schemaTool = new SchemaTool($this->dm); } $prime = []; $classes = []; foreach ($this->usedModelSets as $setName => $bool) { foreach (static::$_modelSets[$setName] as $className) { $prime[$setName][] = $this->dm->getClassMetadata($className); } if (!isset(static::$_classesCreated[$setName])) { $classes = array_merge($classes, $prime[$setName]); static::$_classesCreated[$setName] = true; } } if ($classes) { $this->schemaTool->createSchema($classes); } }