-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
328 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Polymorphine/Headers package. | ||
* | ||
* (c) Shudd3r <q3.shudder@gmail.com> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Polymorphine\Headers\Tests\Doubles; | ||
|
||
use Psr\Http\Message\ServerRequestInterface; | ||
use Psr\Http\Message\StreamInterface; | ||
use Psr\Http\Message\UriInterface; | ||
|
||
|
||
class DummyServerRequest implements ServerRequestInterface | ||
{ | ||
public ?UriInterface $uri; | ||
|
||
public function __construct(UriInterface $uri = null) | ||
{ | ||
$this->uri = $uri; | ||
} | ||
|
||
public function getMethod(): string | ||
{ | ||
return 'GET'; | ||
} | ||
|
||
public function getUri(): UriInterface | ||
{ | ||
return $this->uri; | ||
} | ||
|
||
public function getRequestTarget(): string | ||
{ | ||
return 'foo?bar=baz'; | ||
} | ||
|
||
public function getProtocolVersion(): string | ||
{ | ||
return '1.1'; | ||
} | ||
|
||
public function withProtocolVersion($version): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function getHeaders(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function hasHeader($name): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function getHeader($name): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function getHeaderLine($name): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function withHeader($name, $value): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function withAddedHeader($name, $value): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function withoutHeader($name): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function getBody(): StreamInterface | ||
{ | ||
return new DummyStream(); | ||
} | ||
|
||
public function withBody(StreamInterface $body): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function withRequestTarget($requestTarget): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function withMethod($method): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function withUri(UriInterface $uri, $preserveHost = false): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function getServerParams(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function getCookieParams(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function withCookieParams(array $cookies): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function getQueryParams(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function withQueryParams(array $query): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function getUploadedFiles(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function withUploadedFiles(array $uploadedFiles): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function getParsedBody(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function withParsedBody($data): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function getAttributes(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function getAttribute($name, $default = null) | ||
{ | ||
return $default; | ||
} | ||
|
||
public function withAttribute($name, $value): self | ||
{ | ||
return $this; | ||
} | ||
|
||
public function withoutAttribute($name): self | ||
{ | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Polymorphine/Headers package. | ||
* | ||
* (c) Shudd3r <q3.shudder@gmail.com> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Polymorphine\Headers\Tests\Doubles; | ||
|
||
use Psr\Http\Message\StreamInterface; | ||
|
||
|
||
class DummyStream implements StreamInterface | ||
{ | ||
public function __toString(): string | ||
{ | ||
return 'Hello world'; | ||
} | ||
|
||
public function close(): void | ||
{ | ||
} | ||
|
||
public function detach() | ||
{ | ||
} | ||
|
||
public function getSize(): ?int | ||
{ | ||
return 10; | ||
} | ||
|
||
public function tell(): int | ||
{ | ||
return 5; | ||
} | ||
|
||
public function eof(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function isSeekable(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function seek($offset, $whence = SEEK_SET): void | ||
{ | ||
} | ||
|
||
public function rewind(): void | ||
{ | ||
} | ||
|
||
public function isWritable(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function write($string): void | ||
{ | ||
} | ||
|
||
public function isReadable(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function read($length): string | ||
{ | ||
return 'Hello'; | ||
} | ||
|
||
public function getContents(): string | ||
{ | ||
return ' World'; | ||
} | ||
|
||
public function getMetadata($key = null): array | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.