예제 #1
0
 /**
  * @test
  */
 public function findAllVolumes()
 {
     $this->obj->flush();
     $volume = new Volume();
     $volume->number = 20;
     $volume->title = "Volume 20";
     $volume->pagenumber = 20;
     $this->obj->save($volume);
     $objs = $this->obj->find();
     $this->assertInternalType('array', $objs);
     $this->assertTrue(1 == count($objs));
     foreach ($objs as $obj) {
         $this->assertInstanceOf('TEIShredder\\Volume', $obj);
     }
 }
예제 #2
0
 /**
  * Callback function for occurrences of <titlePart> elements.
  *
  * This method expects each <text> to have one <titlePart>. If there is
  * more than one, subclasses may be used to filter the unwanted title(s).
  *
  * @throws \RuntimeException
  */
 protected function processTitlePart()
 {
     $title = $this->plaintextConverter->convert($this->r->readOuterXML());
     // Check for uniqueness
     if (!empty($this->data['volTitles'][$this->data['currentVolume']])) {
         throw new \RuntimeException('Multiple <titlePart> elements for volume ' . $this->data['currentVolume'] . ":\n");
     }
     $this->data['volTitles'][$this->data['currentVolume']] = true;
     $volume = $this->setup->factory->createVolume();
     $volume->number = $this->data['currentVolume'];
     $volume->title = $title;
     $volume->pagenumber = $this->data['currTextStart'];
     $this->volumeGateway->save($volume);
 }