public function testPool() { $formatter = new RawFormatter(); $env = $this->getMock('\\Twig_Environment'); $env->expects($this->once())->method('render')->will($this->returnValue('Salut')); $pool = new Pool(); $this->assertFalse($pool->has('foo')); $pool->add('foo', $formatter, $env); $this->assertTrue($pool->has('foo')); $this->assertEquals('Salut', $pool->transform('foo', 'Salut')); }
/** * {@inheritdoc} */ public function validate($value, Constraint $constraint) { if (!$this->pool->has($value)) { $this->context->addViolation($constraint->message); } }