public function testAttachToRightEvent() { $guard = new RouteGuard($this->getMock('ZfjRbac\\Service\\RoleService', [], [], '', false)); $eventManager = $this->getMock('Zend\\EventManager\\EventManagerInterface'); $eventManager->expects($this->once())->method('attach')->with(RouteGuard::EVENT_NAME); $guard->attach($eventManager); }