public function testGetSettingValueReturnsValueIfSet()
 {
     $mock = new AccessiblePlugin();
     $mock->initialize(array('exists' => 'expected'));
     $result = $mock->getSettingValue('exists', NULL);
     $this->assertEquals('expected', $result);
 }
Example #2
0
 public function testDispatchPluginEventWithExceptionAddsToResponse()
 {
     $plugin = new AccessiblePlugin();
     $plugin->initialize(array(AbstractPlugin::OPTION_EVENTS_ONSTART => array(get_class($plugin) => array())));
     $exception = new \RuntimeException();
     $payload = $this->getMockBuilder('NamelessCoder\\Gizzle\\Payload')->setMethods(array('loadPluginInstances', 'executePlugin'))->setConstructorArgs(array('{}', ''))->getMock();
     $payload->expects($this->once())->method('loadPluginInstances')->with($plugin->getSetting(AbstractPlugin::OPTION_EVENTS_ONSTART))->will($this->returnValue(array($plugin)));
     $payload->expects($this->once())->method('executePlugin')->with($plugin, FALSE)->willReturn($exception);
     $method = new \ReflectionMethod($payload, 'dispatchPluginEvent');
     $method->setAccessible(TRUE);
     $method->invoke($payload, $plugin, AbstractPlugin::OPTION_EVENTS_ONSTART);
     $this->assertNotEmpty($payload->getResponse()->getOutput());
 }