Skip to content

Commit 10eb409

Browse files
koenreiniersfabpot
authored andcommitted
[FrameworkBundle] Add BrowserKitAssertionsTrait::assertThatForBrowser
1 parent fa54ebb commit 10eb409

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Test/BrowserKitAssertionsTrait.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,17 @@ public static function assertResponseCookieValueSame(string $name, string $expec
9696

9797
public static function assertBrowserHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
9898
{
99-
self::assertThat(self::getClient(), new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain), $message);
99+
self::assertThatForClient(new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain), $message);
100100
}
101101

102102
public static function assertBrowserNotHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
103103
{
104-
self::assertThat(self::getClient(), new LogicalNot(new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain)), $message);
104+
self::assertThatForClient(new LogicalNot(new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain)), $message);
105105
}
106106

107107
public static function assertBrowserCookieValueSame(string $name, string $expectedValue, bool $raw = false, string $path = '/', string $domain = null, string $message = ''): void
108108
{
109-
self::assertThat(self::getClient(), LogicalAnd::fromConstraints(
109+
self::assertThatForClient(LogicalAnd::fromConstraints(
110110
new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain),
111111
new BrowserKitConstraint\BrowserCookieValueSame($name, $expectedValue, $raw, $path, $domain)
112112
), $message);
@@ -146,6 +146,11 @@ public static function assertThatForResponse(Constraint $constraint, string $mes
146146
}
147147
}
148148

149+
public static function assertThatForClient(Constraint $constraint, string $message = ''): void
150+
{
151+
self::assertThat(self::getClient(), $constraint, $message);
152+
}
153+
149154
private static function getClient(AbstractBrowser $newClient = null): ?AbstractBrowser
150155
{
151156
static $client;

0 commit comments

Comments
 (0)