示例#1
0
文件: HooksTest.php 项目: kyfr59/cg35
 public function testItemsShowPanel()
 {
     $this->_authenticateUser($this->_getDefaultUser());
     $orig = insert_item();
     $dup1 = insert_item();
     $dup2 = insert_item();
     $identifier = 'my-fake-id';
     $datestamp = '2011-07-24';
     $harvestId = 10000;
     foreach (array($orig, $dup1, $dup2) as $item) {
         $record = new OaipmhHarvester_Record();
         $record->setArray(array('identifier' => $identifier, 'item_id' => $item->id, 'datestamp' => $datestamp, 'harvest_id' => $harvestId));
         $record->save();
     }
     $this->dispatch('/items/show/' . $orig->id);
     $this->assertQuery('div#harvester-duplicates');
     $this->assertQueryCount('div#harvester-duplicates li', 2, "Should be 2 duplicates of this item.");
 }
示例#2
0
 public function testRecordExists()
 {
     $record = new OaipmhHarvester_Record();
     $item = insert_item(array('public' => true));
     $harvest = new OaipmhHarvester_Harvest();
     $record->item_id = $item->id;
     $record->identifier = 'foo-bar';
     $record->datestamp = '2010-04-28';
     $harvest->base_url = 'http://example.com';
     $harvest->metadata_prefix = 'oai_dc';
     $harvest->status = OaipmhHarvester_Harvest::STATUS_COMPLETED;
     $request = new OaipmhHarvester_Request_Mock();
     $xmlFile = dirname(__FILE__) . '/_files/ListRecords.xml';
     $request->setResponseXml(file_get_contents($xmlFile));
     $harvest->setRequest($request);
     $harvest->save();
     $record->harvest_id = $harvest->id;
     $record->save();
     $harvester = new OaipmhHarvester_Harvest_OaiDc($harvest);
     $harvester->harvest();
     $item = $this->db->getTable('Item')->find($record->item_id);
     $this->assertEquals("Record Title", metadata($item, array('Dublin Core', 'Title')));
 }
示例#3
0
文件: Abstract.php 项目: kyfr59/cg35
 /**
  * Update a record in the database with information from this harvest.
  * 
  * @param OaipmhHarvester_Record The model object corresponding to the record.
  */
 private function _updateRecord(OaipmhHarvester_Record $record)
 {
     $record->datestamp = (string) $this->_record->header->datestamp;
     $record->save();
 }