public function testPersistClazzWithConstant() { $this->packageVersion->addContainer($foo = new Clazz('Foo')); $foo->addConstant($constant = new Constant('BAR')); $constant->setPhpType($this->typeRegistry->getNativeType('string')); $this->persister->persist($this->packageVersion); $reloadedFoo = $this->em->createQuery('SELECT c FROM Scrutinizer\\PhpAnalyzer\\Model\\Clazz c WHERE c.name = :name')->setParameter('name', 'Foo')->getSingleResult(); assert($reloadedFoo instanceof Clazz); $this->assertTrue($reloadedFoo->hasConstant('BAR')); $this->assertEquals('string', (string) $reloadedFoo->getConstant('BAR')->getPhpType()); }