public function testCallReturnsPluginIfPluginIsNotCallable() { $plugins = new ControllerPlugins(); $plugin = new \stdClass(); $plugins->set('foo', $plugin); $controller = new PluginsTraitTemplate(); $controller->setPlugins($plugins); $return = $controller->foo(); $this->assertSame($return, $plugin); }
public function testGetPlugin() { $options = ['foo' => 'bar', 'bat' => 'baz']; $plugin = $this->getMock('FakePlugin', ['setOptions']); $plugins = new ControllerPlugins(); $plugins->set('foo', $plugin); $plugin->expects($this->once())->method('setOptions')->with($this->identicalTo($options)); $result = $plugins->getPlugin('foo', $options); $this->assertSame($result, $plugin); }
public function testGetUrl() { $url = new Url(); $plugins = new ControllerPlugins(); $plugins->set('url', $url); $services = new Services(); $services->set('ControllerPlugins', $plugins); $this->setServices($services); $plugin = new Redirect(); $this->assertSame($url, $plugin->getUrl()); }