Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit adafb8b

Browse filesBrowse files
committed
try to work around the LogicalNot(ResponseHeaderSame) behaviour
1 parent f9660cc commit adafb8b
Copy full SHA for adafb8b

File tree

2 files changed

+5
-3
lines changed
Filter options

2 files changed

+5
-3
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php
+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static function assertResponseHeaderSame(string $headerName, string $expe
7979

8080
public static function assertResponseHeaderNotSame(string $headerName, string $expectedValue, string $message = ''): void
8181
{
82-
self::assertThatForResponse(new LogicalNot(new ResponseConstraint\ResponseHeaderSame($headerName, $expectedValue)), $message);
82+
self::assertThatForResponse(new LogicalNot(new ResponseConstraint\ResponseHeaderSame($headerName, $expectedValue, true)), $message);
8383
}
8484

8585
public static function assertResponseHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void

‎src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseHeaderSame.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseHeaderSame.php
+4-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ final class ResponseHeaderSame extends Constraint
1818
{
1919
private string $headerName;
2020
private string $expectedValue;
21+
private bool $logicalNot;
2122
private ?string $actualValue = null;
2223

23-
public function __construct(string $headerName, string $expectedValue)
24+
public function __construct(string $headerName, string $expectedValue, bool $logicalNot = false)
2425
{
2526
$this->headerName = $headerName;
2627
$this->expectedValue = $expectedValue;
28+
$this->logicalNot = $logicalNot;
2729
}
2830

2931
public function toString(): string
@@ -34,7 +36,7 @@ public function toString(): string
3436
$output .= sprintf(', header "%s" is not set', $this->headerName);
3537
}
3638

37-
if (null !== $this->actualValue) {
39+
if (null !== $this->actualValue && !$this->logicalNot) {
3840
$output .= sprintf(', value of header "%s" is "%s"', $this->headerName, $this->actualValue);
3941
}
4042

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.