public function testReflection() { $validator = Validation::createValidatorBuilder()->enableAnnotationMapping()->getValidator(); $factory = new ReflectionFactory([new \Mapped\Extension\SymfonyValidation($validator)]); $mapping = $factory->of('Mapped\\Tests\\Fixtures\\Book')->enableObjectValidation(); $this->setExpectedException('Mapped\\ValidationException'); try { $book = $mapping->apply(['title' => '']); } catch (ValidationException $e) { $errors = $e->getErrors(); $this->assertSame('not-blank', $errors[0]->getMessage()); $this->assertSame(['title'], $errors[0]->getPropertyPath()); throw $e; } }
public function testH() { $factory = new ReflectionFactory(); $this->assertNotSame($factory->of('string'), $factory->of('string')); $this->assertNotSame($factory->of('Mapped\\Tests\\Fixtures\\Book'), $factory->of('Mapped\\Tests\\Fixtures\\Book')); }