Example #1
0
 /**
  * Constructor
  *
  * @param \Zend\Config\Config              $config        Configuration
  * representing the [Catalog] section of config.ini
  * @param \VuFind\ILS\Driver\PluginManager $driverManager Driver plugin manager
  * @param \VuFind\Config\PluginManager     $configReader  Configuration loader
  */
 public function __construct(\Zend\Config\Config $config, \VuFind\ILS\Driver\PluginManager $driverManager, \VuFind\Config\PluginManager $configReader)
 {
     $this->config = $config;
     $this->configReader = $configReader;
     if (!isset($this->config->driver)) {
         throw new \Exception('ILS driver setting missing.');
     }
     $service = $this->config->driver;
     if (!$driverManager->has($service)) {
         throw new \Exception('ILS driver missing: ' . $service);
     }
     $this->setDriver($driverManager->get($service));
     // If we're configured to fail over to the NoILS driver, we need
     // to test if the main driver is working.
     if (isset($this->config->loadNoILSOnFailure) && $this->config->loadNoILSOnFailure) {
         try {
             $this->getDriver();
         } catch (\Exception $e) {
             $this->setDriver($driverManager->get('NoILS'));
         }
     }
 }
Example #2
0
 /**
  * Test expected interface.
  *
  * @return void
  *
  * @expectedException        Zend\ServiceManager\Exception\RuntimeException
  * @expectedExceptionMessage Plugin ArrayObject does not belong to VuFind\ILS\Driver\DriverInterface
  */
 public function testExpectedInterface()
 {
     $pm = new PluginManager(null);
     $pm->validatePlugin(new \ArrayObject());
 }