*/ class TestimonialControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase { /** * @var bool */ protected $backupGlobals = false; /** * @var TestimonialController */ protected $subject = null; /** * @var ViewInterface|ObjectProphecy */ protected $viewProphecy = null; /** * @var ViewInterface|ProphecySubjectInterface */ protected $view = null; /** * @var TestimonialRepository|ObjectProphecy */ protected $testimonialRepositoryProphecy = null; /** * @var TestimonialRepository|ProphecySubjectInterface */ protected $testimonialRepository = null; protected function setUp() { $this->subject = new TestimonialController(); $this->viewProphecy = $this->prophesize(ViewInterface::class); $this->view = $this->viewProphecy->reveal(); $this->inject($this->subject, 'view', $this->view); $this->testimonialRepositoryProphecy = $this->prophesize(TestimonialRepository::class); $this->testimonialRepository = $this->testimonialRepositoryProphecy->reveal(); $this->inject($this->subject, 'testimonialRepository', $this->testimonialRepository); } /** * @test */ public function indexActionCanBeCalled() { $this->subject->indexAction(); } /** * @test */ public function indexActionPassesAllTestimonialsAsTestimonialsToView() { $allTestimonials = new ObjectStorage(); $this->testimonialRepositoryProphecy->findAll()->willReturn($allTestimonials); $this->viewProphecy->assign('testimonials', $allTestimonials)->shouldBeCalled(); $this->subject->indexAction(); } }