entityService = $this->prophesize(ArticleService::class); $this->entityService->willImplement(EntityServiceInterface::class); $this->entityService->delete(1)->willReturn(true); $this->entityService->delete(10)->willReturn(false); } public function testCanDelete() { $page = new DeleteAction($this->entityService->reveal()); $request = new ServerRequest(); $response = $page($request->withAttribute('id', 1), new Response(), function () { }); $this->assertTrue($response instanceof Response); $this->assertEquals('true', $response->getBody()->getContents()); } public function testCantDelete() { $page = new DeleteAction($this->entityService->reveal()); $request = new ServerRequest(); $response = $page($request->withAttribute('id', 10), new Response(), function () { }); $this->assertTrue($response instanceof Response); $this->assertEquals('false', $response->getBody()->getContents()); } }