Esempio n. 1
0
 /**
  * Test performing a search.
  *
  * @return void
  */
 public function testSearch()
 {
     $conn = $this->getConnectorMock(['search']);
     $conn->expects($this->once())->method('search')->will($this->returnValue($this->loadResponse('search')));
     $back = new Backend($conn);
     $back->setIdentifier('test');
     $coll = $back->search(new Query('foobar'), 0, 3);
     $this->assertCount(3, $coll);
     $this->assertEquals('test', $coll->getSourceIdentifier());
     $rec = $coll->first();
     $this->assertEquals('test', $rec->getSourceIdentifier());
     $this->assertEquals('793503125', $rec->getMarc()->getField('001')->getData());
     $recs = $coll->getRecords();
     $this->assertEquals('test', $recs[1]->getSourceIdentifier());
     $this->assertEquals('798169104', $recs[1]->getMarc()->getField('001')->getData());
     $this->assertEquals('test', $recs[2]->getSourceIdentifier());
     $this->assertEquals('44310183', $recs[2]->getMarc()->getField('001')->getData());
 }