/** * @return IdeaService */ public function getIdeaService() { if (is_null($this->ideaService)) { $this->ideaService = new IdeaService(); $this->ideaService->setIdea(new Idea()); } return $this->ideaService; }
/** * {@inheritDoc} */ public function setUp() { $this->serviceManager = Bootstrap::getServiceManager(); $idea = new Idea(); $idea->setId(1); $idea->setNumber(123123); $idea->setIdea('This is the idea'); $this->ideaService = $this->serviceManager->get(IdeaService::class); $this->ideaService->setIdea($idea); $authorizeServiceMock = $this->getMockBuilder('BjyAuthorize\\View\\Helper\\IsAllowed')->disableOriginalConstructor()->getMock(); $authorizeServiceMock->expects($this->any())->method('__invoke')->will($this->returnValue(true)); $viewHelperManager = $this->serviceManager->get('viewhelpermanager'); $viewHelperManager->setService('isAllowed', $authorizeServiceMock); $urlViewHelperMock = $this->getMockBuilder(Url::class)->disableOriginalConstructor()->getMock(); $urlViewHelperMock->expects($this->any())->method('__invoke')->will($this->returnValue(true)); $viewHelperManager->setService('url', $urlViewHelperMock); $this->ideaLink = $this->serviceManager->get('viewhelpermanager')->get('idealink'); }