/** * @param string $class * @param Constraint $constraint * @param array $translations * * @test * @dataProvider validProvider */ public function validConstraintCreation($class, Constraint $constraint, array $translations) { foreach ($translations as $translation) { if (count($translation['config']) <= 0) { continue; } $this->configureTranslator($translation['message'], $translation['config']); } $object = $this->createFactory()->create($constraint); $attributes = $object->normalize($this->normalizer->reveal()); $this->assertInstanceOf($class, $object); foreach ($translations as $name => $translation) { $this->assertSame($translation['message'], $attributes[sprintf('%s-message', $name)]); } }
/** * @param string $triggerEvent * @param bool $global * * @return ParsleyTypeExtension */ private function createExtension($triggerEvent = 'blur', $global = true) { return new ParsleyTypeExtension($this->builder->reveal(), $this->normalizer->reveal(), $this->validator->reveal(), $global, $triggerEvent); }