/** * @expectedException Linio\Component\Input\Exception\InvalidConstraintException */ public function testIsCheckingConstraintsOnValue() { $typeHandler = $this->prophesize(TypeHandler::class); $typeHandler->getType('int')->willReturn(new ScalarCollectionNode()); $constraint = $this->prophesize(ConstraintInterface::class); $constraint->validate([15, 25, 36])->willReturn(false); $constraint->getErrorMessage('foobar')->shouldBeCalled(); $base = new ScalarCollectionNode(); $base->setTypeHandler($typeHandler->reveal()); $child = $base->add('foobar', 'int', ['constraints' => [$constraint->reveal()]]); $child->setType('int'); $child->getValue('foobar', [15, 25, 36]); }