Updates to vendors etc

This commit is contained in:
Chris Hunt
2025-07-11 15:57:48 +01:00
parent d972cbcd0a
commit 8fb6438254
8043 changed files with 248005 additions and 189479 deletions

View File

@@ -16,18 +16,15 @@ use Symfony\Component\HttpFoundation\Request;
final class RequestAttributeValueSame extends Constraint
{
private string $name;
private string $value;
public function __construct(string $name, string $value)
{
$this->name = $name;
$this->value = $value;
public function __construct(
private string $name,
private string $value,
) {
}
public function toString(): string
{
return sprintf('has attribute "%s" with value "%s"', $this->name, $this->value);
return \sprintf('has attribute "%s" with value "%s"', $this->name, $this->value);
}
/**

View File

@@ -17,31 +17,25 @@ use Symfony\Component\HttpFoundation\Response;
final class ResponseCookieValueSame extends Constraint
{
private string $name;
private string $value;
private string $path;
private ?string $domain;
public function __construct(string $name, string $value, string $path = '/', ?string $domain = null)
{
$this->name = $name;
$this->value = $value;
$this->path = $path;
$this->domain = $domain;
public function __construct(
private string $name,
private string $value,
private string $path = '/',
private ?string $domain = null,
) {
}
public function toString(): string
{
$str = sprintf('has cookie "%s"', $this->name);
$str = \sprintf('has cookie "%s"', $this->name);
if ('/' !== $this->path) {
$str .= sprintf(' with path "%s"', $this->path);
$str .= \sprintf(' with path "%s"', $this->path);
}
if ($this->domain) {
$str .= sprintf(' for domain "%s"', $this->domain);
$str .= \sprintf(' for domain "%s"', $this->domain);
}
$str .= sprintf(' with value "%s"', $this->value);
return $str;
return $str.\sprintf(' with value "%s"', $this->value);
}
/**

View File

@@ -22,13 +22,11 @@ use Symfony\Component\HttpFoundation\Response;
*/
final class ResponseFormatSame extends Constraint
{
private Request $request;
private ?string $format;
public function __construct(Request $request, ?string $format)
{
$this->request = $request;
$this->format = $format;
public function __construct(
private Request $request,
private ?string $format,
private readonly bool $verbose = true,
) {
}
public function toString(): string
@@ -57,6 +55,6 @@ final class ResponseFormatSame extends Constraint
*/
protected function additionalFailureDescription($response): string
{
return (string) $response;
return $this->verbose ? (string) $response : explode("\r\n\r\n", (string) $response)[0];
}
}

View File

@@ -17,25 +17,21 @@ use Symfony\Component\HttpFoundation\Response;
final class ResponseHasCookie extends Constraint
{
private string $name;
private string $path;
private ?string $domain;
public function __construct(string $name, string $path = '/', ?string $domain = null)
{
$this->name = $name;
$this->path = $path;
$this->domain = $domain;
public function __construct(
private string $name,
private string $path = '/',
private ?string $domain = null,
) {
}
public function toString(): string
{
$str = sprintf('has cookie "%s"', $this->name);
$str = \sprintf('has cookie "%s"', $this->name);
if ('/' !== $this->path) {
$str .= sprintf(' with path "%s"', $this->path);
$str .= \sprintf(' with path "%s"', $this->path);
}
if ($this->domain) {
$str .= sprintf(' for domain "%s"', $this->domain);
$str .= \sprintf(' for domain "%s"', $this->domain);
}
return $str;

View File

@@ -16,16 +16,14 @@ use Symfony\Component\HttpFoundation\Response;
final class ResponseHasHeader extends Constraint
{
private string $headerName;
public function __construct(string $headerName)
{
$this->headerName = $headerName;
public function __construct(
private string $headerName,
) {
}
public function toString(): string
{
return sprintf('has header "%s"', $this->headerName);
return \sprintf('has header "%s"', $this->headerName);
}
/**

View File

@@ -23,7 +23,7 @@ final class ResponseHeaderLocationSame extends Constraint
public function toString(): string
{
return sprintf('has header "Location" matching "%s"', $this->expectedValue);
return \sprintf('has header "Location" matching "%s"', $this->expectedValue);
}
protected function matches($other): bool
@@ -53,7 +53,7 @@ final class ResponseHeaderLocationSame extends Constraint
}
if (str_starts_with($url, '//')) {
return sprintf('%s:%s', $this->request->getScheme(), $url);
return \sprintf('%s:%s', $this->request->getScheme(), $url);
}
if (str_starts_with($url, '/')) {

View File

@@ -16,18 +16,15 @@ use Symfony\Component\HttpFoundation\Response;
final class ResponseHeaderSame extends Constraint
{
private string $headerName;
private string $expectedValue;
public function __construct(string $headerName, string $expectedValue)
{
$this->headerName = $headerName;
$this->expectedValue = $expectedValue;
public function __construct(
private string $headerName,
private string $expectedValue,
) {
}
public function toString(): string
{
return sprintf('has header "%s" with value "%s"', $this->headerName, $this->expectedValue);
return \sprintf('has header "%s" with value "%s"', $this->headerName, $this->expectedValue);
}
/**

View File

@@ -16,6 +16,13 @@ use Symfony\Component\HttpFoundation\Response;
final class ResponseIsRedirected extends Constraint
{
/**
* @param bool $verbose If true, the entire response is printed on failure. If false, the response body is omitted.
*/
public function __construct(private readonly bool $verbose = true)
{
}
public function toString(): string
{
return 'is redirected';
@@ -42,6 +49,6 @@ final class ResponseIsRedirected extends Constraint
*/
protected function additionalFailureDescription($response): string
{
return (string) $response;
return $this->verbose ? (string) $response : explode("\r\n\r\n", (string) $response)[0];
}
}

View File

@@ -16,6 +16,13 @@ use Symfony\Component\HttpFoundation\Response;
final class ResponseIsSuccessful extends Constraint
{
/**
* @param bool $verbose If true, the entire response is printed on failure. If false, the response body is omitted.
*/
public function __construct(private readonly bool $verbose = true)
{
}
public function toString(): string
{
return 'is successful';
@@ -42,6 +49,6 @@ final class ResponseIsSuccessful extends Constraint
*/
protected function additionalFailureDescription($response): string
{
return (string) $response;
return $this->verbose ? (string) $response : explode("\r\n\r\n", (string) $response)[0];
}
}

View File

@@ -16,6 +16,13 @@ use Symfony\Component\HttpFoundation\Response;
final class ResponseIsUnprocessable extends Constraint
{
/**
* @param bool $verbose If true, the entire response is printed on failure. If false, the response body is omitted.
*/
public function __construct(private readonly bool $verbose = true)
{
}
public function toString(): string
{
return 'is unprocessable';
@@ -38,10 +45,10 @@ final class ResponseIsUnprocessable extends Constraint
}
/**
* @param Response $other
* @param Response $response
*/
protected function additionalFailureDescription($other): string
protected function additionalFailureDescription($response): string
{
return (string) $other;
return $this->verbose ? (string) $response : explode("\r\n\r\n", (string) $response)[0];
}
}

View File

@@ -16,11 +16,10 @@ use Symfony\Component\HttpFoundation\Response;
final class ResponseStatusCodeSame extends Constraint
{
private int $statusCode;
public function __construct(int $statusCode)
{
$this->statusCode = $statusCode;
public function __construct(
private int $statusCode,
private readonly bool $verbose = true,
) {
}
public function toString(): string
@@ -49,6 +48,6 @@ final class ResponseStatusCodeSame extends Constraint
*/
protected function additionalFailureDescription($response): string
{
return (string) $response;
return $this->verbose ? (string) $response : explode("\r\n\r\n", (string) $response)[0];
}
}