/**
  * Harvest OAI-PMH records.
  *
  * @return \Zend\Console\Response
  */
 public function harvestoaiAction()
 {
     $this->checkLocalSetting();
     // Get default options, add the default --ini setting if missing:
     $opts = HarvesterConsoleRunner::getDefaultOptions();
     if (!$opts->getOption('ini')) {
         $ini = \VuFind\Config\Locator::getConfigPath('oai.ini', 'harvest');
         $opts->addArguments(['--ini=' . $ini]);
     }
     // Get the default VuFind HTTP client:
     $client = $this->getServiceLocator()->get('VuFind\\Http')->createClient();
     // Run the job!
     $runner = new HarvesterConsoleRunner($opts, $client, $this->getHarvestRoot());
     return $runner->run() ? $this->getSuccessResponse() : $this->getFailureResponse();
 }
 /**
  * Test basic functionality of console runner w/ settings overridden
  * by command-line options.
  *
  * @return void
  */
 public function testRunFromIniFileWithOptionOverrides()
 {
     $basePath = '/foo/bar';
     $client = $this->getMock('Zend\\Http\\Client');
     $harvester = $this->getMockHarvester();
     $expectedSettings = ['url' => 'http://bar', 'metadataPrefix' => 'oai_dc', 'from' => null, 'until' => null, 'silent' => false, 'verbose' => true, 'timeout' => 45];
     $factory = $this->getMock('VuFindHarvest\\OaiPmh\\HarvesterFactory');
     $factory->expects($this->once())->method('getHarvester')->with($this->equalTo('foo'), $this->equalTo($basePath), $this->equalTo($client), $this->equalTo($expectedSettings))->will($this->returnValue($harvester));
     $opts = HarvesterConsoleRunner::getDefaultOptions();
     $ini = realpath(__DIR__ . '/../../../../fixtures/test.ini');
     $opts->setArguments(['--ini=' . $ini, '-v', '--timeout=45', 'foo']);
     $runner = new HarvesterConsoleRunner($opts, $client, $basePath, $factory, true);
     $this->assertTrue($runner->run());
 }