public function testValidateEmptyData() { $validator = new ArrayValidator(new Validate(), array(new Property('id', Validate::TYPE_INTEGER), new Property('title', Validate::TYPE_STRING, array(new Filter\Length(2, 8))), new Property('date', Validate::TYPE_STRING, array(new Filter\DateTime())))); $result = $validator->validate(array()); $this->assertArrayHasKey('id', $result); $this->assertEquals(null, $result['id']); $this->assertArrayHasKey('title', $result); $this->assertEquals(null, $result['title']); $this->assertArrayHasKey('date', $result); $this->assertEquals(null, $result['date']); }
public function testGetRecord() { $validator = new ArrayValidator(new Validate(), array(new Property('id', Validate::TYPE_INTEGER), new Property('title', Validate::TYPE_STRING, array(new Filter\Length(1, 2))))); $this->assertInstanceOf('PSX\\Data\\RecordInterface', $validator->getRecord()); $this->assertEquals(array('id' => null, 'title' => null), $validator->getRecord()->getRecordInfo()->getFields()); }