예제 #1
0
파일: Manager.php 프로젝트: htw-pk15/vufind
 /**
  * Helper
  *
  * @param string $method auth method to instantiate
  *
  * @return AbstractBase
  */
 protected function makeAuth($method)
 {
     // If an illegal option was passed in, don't allow the object to load:
     if (!in_array($method, $this->legalAuthOptions)) {
         throw new \Exception("Illegal authentication method: {$method}");
     }
     $auth = $this->pluginManager->get($method);
     $auth->setConfig($this->config);
     return $auth;
 }
예제 #2
0
 /**
  * Get a mock plugin manager.
  *
  * @return PluginManager
  */
 protected function getMockPluginManager()
 {
     $pm = new PluginManager();
     $mockChoice = $this->getMockBuilder('VuFind\\Auth\\ChoiceAuth')->disableOriginalConstructor()->getMock();
     $mockChoice->expects($this->any())->method('getSelectableAuthOptions')->will($this->returnValue(['Database', 'Shibboleth']));
     $mockDb = $this->getMockBuilder('VuFind\\Auth\\Database')->disableOriginalConstructor()->getMock();
     $mockMulti = $this->getMockBuilder('VuFind\\Auth\\MultiILS')->disableOriginalConstructor()->getMock();
     $mockShib = $this->getMockBuilder('VuFind\\Auth\\Shibboleth')->disableOriginalConstructor()->getMock();
     $pm->setService('ChoiceAuth', $mockChoice);
     $pm->setService('Database', $mockDb);
     $pm->setService('MultiILS', $mockMulti);
     $pm->setService('Shibboleth', $mockShib);
     return $pm;
 }
예제 #3
0
 /**
  * Get a mock plugin manager.
  *
  * @return PluginManager
  */
 protected function getMockPluginManager()
 {
     $pm = new PluginManager();
     $mockDb = $this->getMockBuilder('VuFind\\Auth\\Database')->disableOriginalConstructor()->getMock();
     $mockShib = $this->getMockBuilder('VuFind\\Auth\\Shibboleth')->disableOriginalConstructor()->getMock();
     $pm->setService('Database', $mockDb);
     $pm->setService('Shibboleth', $mockShib);
     return $pm;
 }
예제 #4
0
 /**
  * Test expected interface.
  *
  * @return void
  *
  * @expectedException        Zend\ServiceManager\Exception\RuntimeException
  * @expectedExceptionMessage Plugin ArrayObject does not belong to VuFind\Auth\AbstractBase
  */
 public function testExpectedInterface()
 {
     $pm = new PluginManager(null);
     $pm->validatePlugin(new \ArrayObject());
 }