示例#1
0
 /** @test */
 public function should_ignore_missing_nonrequired_fields()
 {
     $segmentMapping = new SegmentMapping('XXX');
     $segmentMapping->addDataElement(1, new DataElementMapping(7583, true, DataElementType::ID, 'ajdi', '', 3));
     $segmentMapping->addDataElement(2, new DataElementMapping(3415, false, DataElementType::A, 'field', '', 35));
     $populator = new SegmentPopulator();
     $populator->setSegmentConfig(['XXX' => $segmentMapping]);
     $data = [['XXX', '345']];
     $segment = $populator->populate($data);
     $this->assertEquals(345, $segment->ajdi);
     $this->assertNull($segment->field);
 }
示例#2
0
 /**
  * @return Segment
  * @throws \EDI\Exception\UnknownSegmentException
  */
 protected function getNextSegment(&$data)
 {
     return $this->segmentPopulator->populate($data);
 }