use PHPUnit\Framework\TestFailure;
use Symfony\Component\BrowserKit\AbstractBrowser;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\BrowserKit\CookieJar;
use Symfony\Component\BrowserKit\Test\Constraint\BrowserCookieValueSame;
class BrowserCookieValueSameTest extends TestCase
{ public function testConstraint() { $browser =
$this->
getBrowser();
$constraint =
new BrowserCookieValueSame('foo', 'bar', false, '/path'
);
$this->
assertTrue($constraint->
evaluate($browser, '', true
));
$constraint =
new BrowserCookieValueSame('foo', 'bar', true, '/path'
);
$this->
assertTrue($constraint->
evaluate($browser, '', true
));
$constraint =
new BrowserCookieValueSame('foo', 'babar', false, '/path'
);
$this->
assertFalse($constraint->
evaluate($browser, '', true
));
try { $constraint->
evaluate($browser);
} catch (ExpectationFailedException
$e) { $this->
assertEquals("Failed asserting that the Browser has cookie \"foo\" with path \"/path\" with value \"babar\".\n", TestFailure::
exceptionToString($e));