aboutsummaryrefslogtreecommitdiff
path: root/tests/Fixtures/TestResponse.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Fixtures/TestResponse.php')
-rw-r--r--tests/Fixtures/TestResponse.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/Fixtures/TestResponse.php b/tests/Fixtures/TestResponse.php
new file mode 100644
index 0000000..25a0307
--- /dev/null
+++ b/tests/Fixtures/TestResponse.php
@@ -0,0 +1,43 @@
+<?php
+
+declare(strict_types=1);
+
+namespace BrettParson\MiniRoute\Tests\Fixtures;
+
+use BrettParson\MiniRoute\Http\ResponseInterface;
+
+final class TestResponse implements ResponseInterface
+{
+ /**
+ * @param array<string, string> $headers
+ */
+ public function __construct(
+ private readonly int $status,
+ private readonly string $body,
+ private readonly array $headers = [],
+ ) {
+ }
+
+ public function status(): int
+ {
+ return $this->status;
+ }
+
+ public function body(): string
+ {
+ return $this->body;
+ }
+
+ public function withHeader(string $name, string $value): ResponseInterface
+ {
+ return new self($this->status, $this->body, array_merge($this->headers, [$name => $value]));
+ }
+
+ /**
+ * @return array<string, string>
+ */
+ public function headers(): array
+ {
+ return $this->headers;
+ }
+}