Example #1
0
 /**
  * @covers \airmoi\FileMaker\Object\Record::validate
  * @todo   Complete testValidate() for Four-Digit validation Rule.
  */
 public function testValidate()
 {
     $this->record->setField('date_field', 'incorrect Date');
     $this->assertInstanceOf(FileMakerValidationException::class, $this->record->validate('date_field'));
     $e = $this->record->validate();
     $this->assertInstanceOf(FileMakerValidationException::class, $this->record->validate());
     $this->assertEquals(1, $this->record->validate()->numErrors());
     $this->record->setField('text_field', str_repeat('0', 51));
     $this->assertEquals(2, $this->record->validate()->numErrors());
     $this->record->setField('text_field', '', 1);
     $this->assertEquals(3, $this->record->validate()->numErrors());
     $this->record->setField('timestamp_field', 'incorrect timestamp', 1);
     $this->assertEquals(4, $this->record->validate()->numErrors());
     $this->record->setField('time_field', 'incorrect time', 1);
     $this->assertEquals(5, $this->record->validate()->numErrors());
     $this->record->setField('number_field', 'incorrect number', 1);
     $this->assertEquals(6, $this->record->validate()->numErrors());
     //$this->record->setField('date_field', '06/16/16', 1);
     //$this->assertEquals(7, $this->record->validate()->numErrors());
 }
Example #2
0
 /**
  *
  * @param Record $record
  * @return boolean
  */
 private function _updateFrom(Record $record)
 {
     $this->recordId = $record->getRecordId();
     $this->modificationId = $record->getModificationId();
     $this->fields = $record->fields;
     $this->layout = $record->layout;
     $this->relatedSets =& $record->relatedSets;
     $this->_modifiedFields = array();
     return true;
 }