Пример #1
0
 /**
  * @param array $data
  *
  * @return Segment
  */
 protected function createSegment($data)
 {
     $segment = new Segment();
     foreach ($data as $field) {
         if (!$field instanceof FieldInterface) {
             $field = new Field($field);
         }
         $segment->addField($field);
     }
     return $segment;
 }
 public function testToString()
 {
     $segment = new Segment();
     $segment->addField(new Field(array('length' => 2, 'type' => new IntegerType(), 'value' => 1)));
     $segment->addField(new Field(array('length' => 3, 'type' => new IntegerType(), 'value' => 10)));
     $segments = new ArrayCollection(array($segment));
     $this->object->setSegments($segments);
     $this->assertCount(1, $this->object->getSegments());
     $this->assertEquals('01010', $this->object->toString());
     $this->assertEquals('01;010', $this->object->toString(';'));
 }