public function testRequiredMessageIncludesType() { $param = new Parameter(array('name' => 'test', 'type' => array('string', 'boolean'), 'required' => true)); $value = null; $this->assertFalse($this->validator->validate($param, $value)); $this->assertEquals(array('[test] is a required string or boolean'), $this->validator->getErrors()); }
public function testValidatesAdditionalPropertiesThatArrayArrays() { $param = new Parameter(array('name' => 'foo', 'type' => 'object', 'additionalProperties' => array('type' => 'array', 'items' => array('type' => 'string')))); $value = array('test' => array(true)); $this->assertFalse($this->validator->validate($param, $value)); $this->assertEquals(array('[foo][test][0] must be of type string'), $this->validator->getErrors()); }