Esempio n. 1
0
 public function testMockReader()
 {
     $reader = new \MockReader();
     list($data) = $reader->Read(5);
     $this->assertEquals($data, "ABCDE");
     list($data) = $reader->Read(27);
     $this->assertEquals($data, "FGHIJKLMNOPQRSTUVWXYZABCDEF");
 }
 public function testModelPeek()
 {
     $rdr = new MockReader();
     $model = new MgFeatureReaderModel(new MockFormatterSet(), $rdr, -1, 0);
     $i = 0;
     while ($model->Peek()) {
         $feat = $model->Current();
         $this->assertEquals($i, $feat->ID);
         $i++;
     }
     $j = 0;
     while ($model->Next()) {
         $feat = $model->Current();
         $this->assertEquals($j, $feat->ID);
         $j++;
     }
     $model->Done();
     $this->assertTrue($rdr->WasClosed());
     $this->assertEquals(5, $i);
     $this->assertEquals(5, $j);
 }