Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEP Require psr/http-message ^2.0 #11505

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"monolog/monolog": "^3.8",
"nikic/php-parser": "^5.3",
"psr/container": "^2.0",
"psr/http-message": "^1",
"psr/http-message": "^2.0",
"sebastian/diff": "^6.0",
"sensiolabs/ansi-to-html": "^1.2",
"silverstripe/config": "^3",
Expand Down
43 changes: 26 additions & 17 deletions tests/php/View/Embed/MockRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\UriInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\MessageInterface;

class MockRequest implements RequestInterface
{
Expand All @@ -17,80 +18,88 @@ public function __construct(EmbedUnitTest $unitTest, MockUri $mockUri)
$this->mockUri = $mockUri;
}

public function getRequestTarget()
public function getRequestTarget(): string
{
return '';
}

public function getMethod()
public function getMethod(): string
{
return '';
}

public function getUri()
public function getUri(): UriInterface
{
$this->unitTest->setFirstRequest(false);
return $this->mockUri;
}

public function getProtocolVersion()
public function getProtocolVersion(): string
{
return '';
}

public function getHeaders()
public function getHeaders(): array
{
return [];
}

public function getHeader($name)
public function getHeader($name): array
{
return [];
}

public function getHeaderLine($name)
public function getHeaderLine($name): string
{
return '';
}

public function getBody()
public function getBody(): StreamInterface
{
return MockUtil::createStreamInterface('');
}

public function hasHeader($name)
public function hasHeader($name): bool
{
return false;
}

public function withHeader($name, $value)
public function withHeader($name, $value): MessageInterface
{
return $this;
}

public function withAddedHeader($name, $value)
public function withAddedHeader($name, $value): MessageInterface
{
return $this;
}

public function withoutHeader($name)
public function withoutHeader($name): MessageInterface
{
return $this;
}

public function withBody(StreamInterface $body)
public function withBody(StreamInterface $body): MessageInterface
{
return $this;
}

public function withProtocolVersion($version)
public function withProtocolVersion($version): MessageInterface
{
return $this;
}

public function withRequestTarget($requestTarget)
public function withRequestTarget($requestTarget): RequestInterface
{
return $this;
}

public function withMethod($method)
public function withMethod($method): RequestInterface
{
return $this;
}

public function withUri(UriInterface $uri, $preserveHost = false)
public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface
{
return $this;
}
Expand Down
35 changes: 18 additions & 17 deletions tests/php/View/Embed/MockResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\MessageInterface;

class MockResponse implements ResponseInterface
{
Expand All @@ -18,78 +19,78 @@ public function __construct(EmbedUnitTest $unitTest, string $firstResponse, stri
$this->secondResponse = $secondResponse;
}

public function getStatusCode()
public function getStatusCode(): int
{
return 200;
}

public function getBody()
public function getBody(): StreamInterface
{
// first request is to the video HTML to get to find the oembed link
// second request is to the oembed endpoint to fetch JSON
if ($this->unitTest->getFirstRequest()) {
return $this->firstResponse;
return MockUtil::createStreamInterface($this->firstResponse);
} else {
return $this->secondResponse;
return MockUtil::createStreamInterface($this->secondResponse);
}
}

public function getReasonPhrase()
public function getReasonPhrase(): string
{
return '';
}

public function getProtocolVersion()
public function getProtocolVersion(): string
{
return '';
}

public function getHeaders()
public function getHeaders(): array
{
return [];
}

public function getHeader($name)
public function getHeader($name): array
{
return '';
return [];
}

public function getHeaderLine($name)
public function getHeaderLine($name): string
{
return '';
}

public function hasHeader($name)
public function hasHeader($name): bool
{
return false;
}

public function withHeader($name, $value)
public function withHeader($name, $value): MessageInterface
{
return $this;
}

public function withAddedHeader($name, $value)
public function withAddedHeader($name, $value): MessageInterface
{
return $this;
}

public function withBody(StreamInterface $body)
public function withBody(StreamInterface $body): MessageInterface
{
return $this;
}

public function withoutHeader($name)
public function withoutHeader($name): MessageInterface
{
return $this;
}

public function withProtocolVersion($version)
public function withProtocolVersion($version): MessageInterface
{
return $this;
}

public function withStatus($code, $reasonPhrase = '')
public function withStatus($code, $reasonPhrase = ''): ResponseInterface
{
return $this;
}
Expand Down
42 changes: 23 additions & 19 deletions tests/php/View/Embed/MockUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

class MockUri implements UriInterface, Stringable
{
private string $scheme;
private string $host;
private string $path;
private string $query;
private string $scheme = '';
private string $host = '';
private string $path = '';
private string $query = '';

public function __construct(string $url)
{
Expand All @@ -21,73 +21,77 @@ public function __construct(string $url)
$this->query = $p['query'] ?? '';
}

public function getScheme()
public function getScheme(): string
{
return $this->scheme;
}

public function getHost()
public function getHost(): string
{
return $this->host;
}

public function getPath()
public function getPath(): string
{
return $this->path;
}

public function getQuery()
public function getQuery(): string
{
return $this->query;
}

public function getPort()
public function getPort(): ?int
{
return null;
}

public function getAuthority()
public function getAuthority(): string
{
return '';
}

public function getUserInfo()
public function getUserInfo(): string
{
return '';
}

public function getFragment()
public function getFragment(): string
{
return '';
}

public function withPath($path)
public function withPath($path): UriInterface
{
return $this;
}

public function withScheme($scheme)
public function withScheme($scheme): UriInterface
{
return $this;
}

public function withUserInfo($user, $password = null)
public function withUserInfo($user, $password = null): UriInterface
{
return $this;
}

public function withHost($host)
public function withHost($host): UriInterface
{
return $this;
}

public function withPort($port)
public function withPort($port): UriInterface
{
return $this;
}

public function withQuery($query)
public function withQuery($query): UriInterface
{
return $this;
}

public function withFragment($fragment)
public function withFragment($fragment): UriInterface
{
return $this;
}
Expand Down
Loading
Loading