/** * @test */ public function listActionFetchesAllMainsFromRepositoryAndAssignsThemToView() { $allMains = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', array(), array(), '', FALSE); $mainRepository = $this->getMock('FIXTURE\\TestExtension\\Domain\\Repository\\MainRepository', array('findAll'), array(), '', FALSE); $mainRepository->expects($this->once())->method('findAll')->will($this->returnValue($allMains)); $this->inject($this->subject, 'mainRepository', $mainRepository); $view = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\View\\ViewInterface'); $view->expects($this->once())->method('assign')->with('mains', $allMains); $this->inject($this->subject, 'view', $view); $this->subject->listAction(); }
/** * @test */ public function listActionFetchesAllMainsFromRepositoryAndAssignsThemToView() { $allMains = $this->getMock(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class, [], [], '', false); $mainRepository = $this->getMock(\FIXTURE\TestExtension\Domain\Repository\MainRepository::class, ['findAll'], [], '', false); $mainRepository->expects(self::once())->method('findAll')->will(self::returnValue($allMains)); $this->inject($this->subject, 'mainRepository', $mainRepository); $view = $this->getMock(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class); $view->expects(self::once())->method('assign')->with('mains', $allMains); $this->inject($this->subject, 'view', $view); $this->subject->listAction(); }