public function testHelperThrowsExceptionWithContainerNotInheritedFromHeadscript() { $this->setExpectedException('SlmGoogleAnalytics\\Exception\\RuntimeException'); $view = $this->helper->getView(); $plugin = new CustomViewHelper(); $plugin->setView($view); $broker = $view->getHelperPluginManager(); $broker->setService('CustomViewHelper', $plugin); $this->helper->setContainerName('CustomViewHelper'); $helper = $this->helper; $helper()->appendScript(); }
public function createService(ServiceLocatorInterface $serviceLocator) { $sm = $serviceLocator->getServiceLocator(); $script = $sm->get('SlmGoogleAnalytics\\Service\\ScriptFactory'); $helper = new GoogleAnalytics($script); $config = $sm->get('config'); $config = $config['google_analytics']; if (isset($config['container_name'])) { $helper->setContainerName($config['container_name']); } return $helper; }