mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-19 21:27:50 +09:00
Update dependencies
This commit is contained in:
@@ -16,8 +16,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
final class RequestAttributeValueSame extends Constraint
|
||||
{
|
||||
private $name;
|
||||
private $value;
|
||||
private string $name;
|
||||
private string $value;
|
||||
|
||||
public function __construct(string $name, string $value)
|
||||
{
|
||||
@@ -25,9 +25,6 @@ final class RequestAttributeValueSame extends Constraint
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return sprintf('has attribute "%s" with value "%s"', $this->name, $this->value);
|
||||
@@ -35,8 +32,6 @@ final class RequestAttributeValueSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($request): bool
|
||||
{
|
||||
@@ -45,8 +40,6 @@ final class RequestAttributeValueSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($request): string
|
||||
{
|
||||
|
||||
@@ -17,12 +17,12 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ResponseCookieValueSame extends Constraint
|
||||
{
|
||||
private $name;
|
||||
private $value;
|
||||
private $path;
|
||||
private $domain;
|
||||
private string $name;
|
||||
private string $value;
|
||||
private string $path;
|
||||
private ?string $domain;
|
||||
|
||||
public function __construct(string $name, string $value, string $path = '/', string $domain = null)
|
||||
public function __construct(string $name, string $value, string $path = '/', ?string $domain = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->value = $value;
|
||||
@@ -30,9 +30,6 @@ final class ResponseCookieValueSame extends Constraint
|
||||
$this->domain = $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
$str = sprintf('has cookie "%s"', $this->name);
|
||||
@@ -49,8 +46,6 @@ final class ResponseCookieValueSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($response): bool
|
||||
{
|
||||
@@ -59,13 +54,11 @@ final class ResponseCookieValueSame extends Constraint
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->value === $cookie->getValue();
|
||||
return $this->value === (string) $cookie->getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($response): string
|
||||
{
|
||||
@@ -76,9 +69,7 @@ final class ResponseCookieValueSame extends Constraint
|
||||
{
|
||||
$cookies = $response->headers->getCookies();
|
||||
|
||||
$filteredCookies = array_filter($cookies, function (Cookie $cookie) {
|
||||
return $cookie->getName() === $this->name && $cookie->getPath() === $this->path && $cookie->getDomain() === $this->domain;
|
||||
});
|
||||
$filteredCookies = array_filter($cookies, fn (Cookie $cookie) => $cookie->getName() === $this->name && $cookie->getPath() === $this->path && $cookie->getDomain() === $this->domain);
|
||||
|
||||
return reset($filteredCookies) ?: null;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
*/
|
||||
final class ResponseFormatSame extends Constraint
|
||||
{
|
||||
private $request;
|
||||
private $format;
|
||||
private Request $request;
|
||||
private ?string $format;
|
||||
|
||||
public function __construct(Request $request, ?string $format)
|
||||
{
|
||||
@@ -31,9 +31,6 @@ final class ResponseFormatSame extends Constraint
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return 'format is '.($this->format ?? 'null');
|
||||
@@ -41,8 +38,6 @@ final class ResponseFormatSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($response): bool
|
||||
{
|
||||
@@ -51,8 +46,6 @@ final class ResponseFormatSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($response): string
|
||||
{
|
||||
@@ -61,8 +54,6 @@ final class ResponseFormatSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function additionalFailureDescription($response): string
|
||||
{
|
||||
|
||||
@@ -17,20 +17,17 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ResponseHasCookie extends Constraint
|
||||
{
|
||||
private $name;
|
||||
private $path;
|
||||
private $domain;
|
||||
private string $name;
|
||||
private string $path;
|
||||
private ?string $domain;
|
||||
|
||||
public function __construct(string $name, string $path = '/', string $domain = null)
|
||||
public function __construct(string $name, string $path = '/', ?string $domain = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->path = $path;
|
||||
$this->domain = $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
$str = sprintf('has cookie "%s"', $this->name);
|
||||
@@ -46,8 +43,6 @@ final class ResponseHasCookie extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($response): bool
|
||||
{
|
||||
@@ -56,8 +51,6 @@ final class ResponseHasCookie extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($response): string
|
||||
{
|
||||
@@ -68,9 +61,7 @@ final class ResponseHasCookie extends Constraint
|
||||
{
|
||||
$cookies = $response->headers->getCookies();
|
||||
|
||||
$filteredCookies = array_filter($cookies, function (Cookie $cookie) {
|
||||
return $cookie->getName() === $this->name && $cookie->getPath() === $this->path && $cookie->getDomain() === $this->domain;
|
||||
});
|
||||
$filteredCookies = array_filter($cookies, fn (Cookie $cookie) => $cookie->getName() === $this->name && $cookie->getPath() === $this->path && $cookie->getDomain() === $this->domain);
|
||||
|
||||
return reset($filteredCookies) ?: null;
|
||||
}
|
||||
|
||||
@@ -16,16 +16,13 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ResponseHasHeader extends Constraint
|
||||
{
|
||||
private $headerName;
|
||||
private string $headerName;
|
||||
|
||||
public function __construct(string $headerName)
|
||||
{
|
||||
$this->headerName = $headerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return sprintf('has header "%s"', $this->headerName);
|
||||
@@ -33,8 +30,6 @@ final class ResponseHasHeader extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($response): bool
|
||||
{
|
||||
@@ -43,8 +38,6 @@ final class ResponseHasHeader extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($response): string
|
||||
{
|
||||
|
||||
65
vendor/symfony/http-foundation/Test/Constraint/ResponseHeaderLocationSame.php
vendored
Normal file
65
vendor/symfony/http-foundation/Test/Constraint/ResponseHeaderLocationSame.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpFoundation\Test\Constraint;
|
||||
|
||||
use PHPUnit\Framework\Constraint\Constraint;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ResponseHeaderLocationSame extends Constraint
|
||||
{
|
||||
public function __construct(private Request $request, private string $expectedValue)
|
||||
{
|
||||
}
|
||||
|
||||
public function toString(): string
|
||||
{
|
||||
return sprintf('has header "Location" matching "%s"', $this->expectedValue);
|
||||
}
|
||||
|
||||
protected function matches($other): bool
|
||||
{
|
||||
if (!$other instanceof Response) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$location = $other->headers->get('Location');
|
||||
|
||||
if (null === $location) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->toFullUrl($this->expectedValue) === $this->toFullUrl($location);
|
||||
}
|
||||
|
||||
protected function failureDescription($other): string
|
||||
{
|
||||
return 'the Response '.$this->toString();
|
||||
}
|
||||
|
||||
private function toFullUrl(string $url): string
|
||||
{
|
||||
if (null === parse_url($url, \PHP_URL_PATH)) {
|
||||
$url .= '/';
|
||||
}
|
||||
|
||||
if (str_starts_with($url, '//')) {
|
||||
return sprintf('%s:%s', $this->request->getScheme(), $url);
|
||||
}
|
||||
|
||||
if (str_starts_with($url, '/')) {
|
||||
return $this->request->getSchemeAndHttpHost().$url;
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,8 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ResponseHeaderSame extends Constraint
|
||||
{
|
||||
private $headerName;
|
||||
private $expectedValue;
|
||||
private string $headerName;
|
||||
private string $expectedValue;
|
||||
|
||||
public function __construct(string $headerName, string $expectedValue)
|
||||
{
|
||||
@@ -25,9 +25,6 @@ final class ResponseHeaderSame extends Constraint
|
||||
$this->expectedValue = $expectedValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return sprintf('has header "%s" with value "%s"', $this->headerName, $this->expectedValue);
|
||||
@@ -35,8 +32,6 @@ final class ResponseHeaderSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($response): bool
|
||||
{
|
||||
@@ -45,8 +40,6 @@ final class ResponseHeaderSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($response): string
|
||||
{
|
||||
|
||||
@@ -16,9 +16,6 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ResponseIsRedirected extends Constraint
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return 'is redirected';
|
||||
@@ -26,8 +23,6 @@ final class ResponseIsRedirected extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($response): bool
|
||||
{
|
||||
@@ -36,8 +31,6 @@ final class ResponseIsRedirected extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($response): string
|
||||
{
|
||||
@@ -46,8 +39,6 @@ final class ResponseIsRedirected extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function additionalFailureDescription($response): string
|
||||
{
|
||||
|
||||
@@ -16,9 +16,6 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ResponseIsSuccessful extends Constraint
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return 'is successful';
|
||||
@@ -26,8 +23,6 @@ final class ResponseIsSuccessful extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($response): bool
|
||||
{
|
||||
@@ -36,8 +31,6 @@ final class ResponseIsSuccessful extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($response): string
|
||||
{
|
||||
@@ -46,8 +39,6 @@ final class ResponseIsSuccessful extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function additionalFailureDescription($response): string
|
||||
{
|
||||
|
||||
@@ -16,9 +16,6 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ResponseIsUnprocessable extends Constraint
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return 'is unprocessable';
|
||||
@@ -26,8 +23,6 @@ final class ResponseIsUnprocessable extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $other
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($other): bool
|
||||
{
|
||||
@@ -36,8 +31,6 @@ final class ResponseIsUnprocessable extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $other
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($other): string
|
||||
{
|
||||
@@ -46,8 +39,6 @@ final class ResponseIsUnprocessable extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $other
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function additionalFailureDescription($other): string
|
||||
{
|
||||
|
||||
@@ -16,16 +16,13 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ResponseStatusCodeSame extends Constraint
|
||||
{
|
||||
private $statusCode;
|
||||
private int $statusCode;
|
||||
|
||||
public function __construct(int $statusCode)
|
||||
{
|
||||
$this->statusCode = $statusCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return 'status code is '.$this->statusCode;
|
||||
@@ -33,8 +30,6 @@ final class ResponseStatusCodeSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($response): bool
|
||||
{
|
||||
@@ -43,8 +38,6 @@ final class ResponseStatusCodeSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($response): string
|
||||
{
|
||||
@@ -53,8 +46,6 @@ final class ResponseStatusCodeSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function additionalFailureDescription($response): string
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user