framework.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. use Psr\Container\ContainerInterface;
  3. use Psr\Http\Message\ResponseFactoryInterface;
  4. use Psr\Http\Message\ResponseInterface;
  5. use Psr\Http\Message\ServerRequestFactoryInterface;
  6. use Psr\Http\Message\ServerRequestInterface;
  7. use Test\Michel\Framework\Core\Mock\ContainerMock;
  8. use Test\Michel\Framework\Core\Mock\ServerRequestMock;
  9. use Test\Michel\Framework\Core\Response\ResponseTest;
  10. return [
  11. 'server_request' => static function (): ServerRequestInterface {
  12. return new ServerRequestMock();
  13. },
  14. 'response_factory' => static function (): ResponseFactoryInterface {
  15. return new class implements ResponseFactoryInterface {
  16. public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
  17. {
  18. return new ResponseTest();
  19. }
  20. };
  21. },
  22. 'server_request_factory' => static function (): ServerRequestFactoryInterface {
  23. return new class implements ServerRequestFactoryInterface {
  24. public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
  25. {
  26. // TODO: Implement createServerRequest() method.
  27. }
  28. };
  29. },
  30. 'container' => static function (array $definitions, array $options): ContainerInterface {
  31. return new ContainerMock($definitions);
  32. },
  33. 'custom_environments' => ['test'],
  34. ];