*/ class TestimonialControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase { /** * @var TestimonialController */ protected $subject = null; /** * @var ViewInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $view = null; /** * @var TestimonialRepository|\PHPUnit_Framework_MockObject_MockObject */ protected $testimonialRepository = null; protected function setUp() { $this->subject = new TestimonialController(); $this->view = $this->getMock(ViewInterface::class); $this->inject($this->subject, 'view', $this->view); $this->testimonialRepository = $this->getMock(TestimonialRepository::class, array(), array(), '', false); $this->inject($this->subject, 'testimonialRepository', $this->testimonialRepository); } /** * @test */ public function indexActionCanBeCalled() { $this->subject->indexAction(); } /** * @test */ public function indexActionPassesAllTestimonialsAsTestimonialsToView() { $allTestimonials = new ObjectStorage(); $this->testimonialRepository->expects(self::any())->method('findAll') ->will(self::returnValue($allTestimonials)); $this->view->expects(self::once())->method('assign')->with('testimonials', $allTestimonials); $this->subject->indexAction(); } }