createMock(IRequest::class); $this->service = $this->createMock(PredefinedStatusService::class); $this->controller = new PredefinedStatusController('user_status', $request, $this->service); } public function testFindAll() { $this->service->expects($this->once()) ->method('getDefaultStatuses') ->with() ->willReturn([ [ 'id' => 'predefined-status-one', ], [ 'id' => 'predefined-status-two', ], ]); $actual = $this->controller->findAll(); $this->assertEquals([ [ 'id' => 'predefined-status-one', ], [ 'id' => 'predefined-status-two', ], ], $actual->getData()); } }