/** @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); }
/** * @return Segment * @throws \EDI\Exception\UnknownSegmentException */ protected function getNextSegment(&$data) { return $this->segmentPopulator->populate($data); }