protected function preparePluginManager()
 {
     if ($this->controller->getPluginManager() instanceof \PHPUnit_Framework_MockObject_MockObject) {
         return $this->controller->getPluginManager();
     }
     $pluginManager = $this->getMock('Zend\\Mvc\\Controller\\PluginManager');
     $this->controller->setPluginManager($pluginManager);
     return $pluginManager;
 }
 public function setPluginManager(PluginManager $plugin)
 {
     parent::setPluginManager($plugin);
     $this->getEventManager()->attach(MvcEvent::EVENT_DISPATCH, array($this, "onInit"), 100);
 }