service = $this->createMock(DeleteShortUrlServiceInterface::class); $this->action = new DeleteShortUrlAction($this->service); } /** @test */ public function emptyResponseIsReturnedIfProperlyDeleted(): void { $apiKey = ApiKey::create(); $this->service->expects($this->once())->method('deleteByShortCode'); $resp = $this->action->handle(ServerRequestFactory::fromGlobals()->withAttribute(ApiKey::class, $apiKey)); self::assertEquals(204, $resp->getStatusCode()); } }