hasPlugin() public method

Returns whether or not at least one instance of a specified plugin class is loaded.
public hasPlugin ( string $name ) : boolean
$name string Short name of the plugin class
return boolean TRUE if an instance exists, FALSE otherwise
Example #1
0
 /**
  * Tests removePlugin() with a plugin short name.
  *
  * @depends testAddPluginByShortName
  * @return void
  */
 public function testRemovePluginByShortName()
 {
     $plugin = 'Mock';
     $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
     $this->handler->addPlugin($plugin);
     $this->handler->removePlugin($plugin);
     $this->assertFalse($this->handler->hasPlugin($plugin), 'Plugin was not removed');
 }
Example #2
0
 /**
  * Can add a plugin to the handler by instance
  *
  * @return void
  */
 public function testAddPluginToHandlerByInstance()
 {
     $plugin = $this->getMock('Phergie_Plugin_Abstract');
     $plugin->expects($this->any())->method('getName')->will($this->returnValue('TestPlugin'));
     $returned_plugin = $this->handler->addPlugin($plugin);
     $this->assertTrue($this->handler->hasPlugin('TestPlugin'));
     $this->assertSame($plugin, $returned_plugin, 'addPlugin returns the same plugin');
     $this->assertSame($plugin, $this->handler->getPlugin('TestPlugin'), 'getPlugin returns the same plugin');
 }