/** * @covers ConstraintFactory::newConstraint * @expectedException Exception * @expectedExceptionMessage Unknown constraint type: allowed */ public function testNewConstraintException() { $type = "allowed"; $actual = \ConstraintFactory::newConstraint("required", $type); $this->assertNull($actual); }
/** * * @param string $name * @param string $type * @param string $forAction * @return Map of Constraint */ public function addConstraint($name, $type, $forAction = null) { $constraint = ConstraintFactory::newConstraint($name, $type, $forAction); // If is readonly, constraint will not be in form (and thus, ignored) if (!$this->isReadonly()) { $this->constraints[] = $constraint; } return $constraint; }