Adds a path to search for plugin class files. Paths are searched in
the reverse order in which they are added.
/** * 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'); }
/** * 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.'); }