public function validate($input) { if (!$this->isArray($input)) { throw new InvalidInputException("The input must be an array"); } if (!$this->keyExists($this->key, $input)) { throw new InvalidInputException("The key does not exists"); } return v::notEmpty()->validate($input[$this->key]); }
/** * @dataProvider providerForEmpty */ public function testInvalidStringShouldFailValidation($input) { $this->assertFalse(v::notEmpty()->validate($input)); }