Example #1
0
 /**
  * Add a copy record.
  *
  * @throws InvalidArgumentException Record already contains the copy record
  * @throws InvalidArgumentException Record already contains a copy record with the same item number
  *
  * @param  CopyRecord $record Copy record to add
  * @return void
  */
 public function addCopyRecord(CopyRecord $record)
 {
     if ($this->getCopyRecordByItemNumber($record->getItemNumber())) {
         throw new InvalidArgumentException("Cannot add copy record: Copy record with item number {$record->getItemNumber()} already present");
     }
     $this->addRecord($record);
     $record->setLocalRecord($this);
 }
Example #2
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testAppendThrowsExceptionOnNumberMismatch()
 {
     $r = new CopyRecord();
     $r->append(new Field('201@', 0));
     $r->append(new Field('202@', 1));
 }