/** * @dataProvider validateProvider */ public function testValidate() { if (func_num_args() > 2) { $this->object->setParameter(func_get_arg(2)); } list($value, $expected) = func_get_args(); $this->assertEquals($expected, $this->object->validate($value)); }
/** * Sets the values to check against * * @param string $params * * @return $this * * @since 2.0 */ public function setParameter($params) { if (!is_array($params)) { $params = [$params]; } return parent::setParameter($params); }
/** * @param ValidatableInterface $params * * @return $this */ public function setParameter($params) { if ($params !== null && !$params instanceof ValidatableInterface) { throw new InvalidArgumentException('VAL-009: Provided parameter does not implement ValidatableInterface'); } return parent::setParameter($params); }
/** * Sets the value to check against * * @param string $params If an array the first value will be used * * @return $this * * @since 2.0 */ public function setParameter($params) { // Ensure we have only a single thing to match against if (is_array($params)) { $params = array_shift($params); } return parent::setParameter($params); }
/** * Sets the value(s) and mode to check against * * @param string $params * * @return $this * * @since 2.0 */ public function setParameter($params) { if (is_array($params) === false) { $params = (array) $params; } elseif (array_key_exists('strict', $params) and array_key_exists('values', $params)) { $this->strict = (bool) $params['strict']; $params = $params['values']; } return parent::setParameter($params); }
public function testGetDefaultMessageParams() { $this->assertEquals(array(), $this->object->getMessageParameters()); }