httpClient = $this->createMock(ApiInterface::class); $this->apiRenderer = new ApiRenderer($this->httpClient); } public function testRender() { $expectedHtml = '

Test

'; $this->httpClient->expects($this->once())->method('getHtml')->willReturn($expectedHtml); $html = $this->apiRenderer->render('Test'); $this->assertEquals($expectedHtml, $html); } }