コード例 #1
0
ファイル: Collection.php プロジェクト: okite11/frames21
 /**
  * Add Record to collection
  *
  * @param \Migration\Resource\Record $record
  * @return $this
  * @throws Exception
  */
 public function addRecord($record)
 {
     if (!$record->getStructure()) {
         $record->setStructure($this->structure);
     }
     if (!$record->validateStructure($this->structure)) {
         throw new Exception("Record structure does not equal Collection structure");
     }
     $this->data[] = $record;
     return $this;
 }
コード例 #2
0
 /**
  * @dataProvider validateStructureDataProvider
  *
  * @param bool $result
  * @param \Migration\Resource\Structure|null $structure
  */
 public function testValidateStructure($result, $structure)
 {
     $this->record->setStructure(null);
     $this->assertEquals($result, $this->record->validateStructure($structure));
 }