*/ 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 */ 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(); } }