addPath() public method

Adds a path to search for plugin class files. Paths are searched in the reverse order in which they are added.
public addPath ( string $path, string $prefix = '' ) : Phergie_Plugin_Handler
$path string Filesystem directory path
$prefix string Optional class name prefix corresponding to the path
return Phergie_Plugin_Handler Provides a fluent interface
Exemplo n.º 1
0
 /**
  * Tests getPlugin() when the plugin is not already loaded and
  * autoloading is disabled.
  *
  * @depends testSetAutoload
  * @return void
  */
 public function testGetPluginWithAutoloadEnabled()
 {
     $this->handler->setAutoload(true);
     $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
     $plugin = $this->handler->getPlugin('Mock');
     $this->assertType('Phergie_Plugin_Mock', $plugin, 'Retrieved plugin not of expected class');
 }
Exemplo n.º 2
0
 /**
  * Tests an exception is thrown when trying to get a plugin
  * that is not already loaded and autoload is off
  *
  * @depends testDefaultsToNotAutoload
  * @return void
  */
 public function testExceptionThrownWhenLoadingPluginWithoutAutoload()
 {
     $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
     try {
         $this->handler->getPlugin('Mock');
     } catch (Phergie_Plugin_Exception $expected) {
         $this->assertEquals(Phergie_Plugin_Exception::ERR_PLUGIN_NOT_LOADED, $expected->getCode());
         return;
     }
     $this->fail('An expected exception has not been raised.');
 }