You've already forked Php-Template
Some checks failed
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Has started running
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Has started running
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Has started running
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Has been cancelled
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Has started running
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Has started running
33 lines
832 B
PHP
33 lines
832 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Siteworxpro\Tests\Http\Middleware;
|
|
|
|
use Nyholm\Psr7\Response;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
use Psr\Http\Server\RequestHandlerInterface;
|
|
use Siteworxpro\Tests\Unit;
|
|
|
|
abstract class Middleware extends Unit
|
|
{
|
|
protected function mockHandler(Response $response): RequestHandlerInterface
|
|
{
|
|
return new class ($response) implements RequestHandlerInterface {
|
|
private Response $response;
|
|
|
|
public function __construct(Response $response)
|
|
{
|
|
$this->response = $response;
|
|
}
|
|
|
|
public function handle(
|
|
ServerRequestInterface $request
|
|
): ResponseInterface {
|
|
return $this->response;
|
|
}
|
|
};
|
|
}
|
|
}
|