*/ 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('TYPO3\\CMS\\Extbase\\Mvc\\View\\ViewInterface'); $this->subject->setView($this->view); $this->testimonialRepository = $this->getMock( 'OliverKlee\\Tea\\Domain\\Repository\\TestimonialRepository', array(), array(), '', FALSE ); $this->subject->injectTestimonialRepository($this->testimonialRepository); } /** * @test * @return void */ public function indexActionCanBeCalled() { $this->subject->indexAction(); } /** * @test * @return void */ 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(); } }