assertBrowserCookieValueSame example

public function testAssertBrowserNotHasCookie()
    {
        $this->getClientTester()->assertBrowserNotHasCookie('bar');
        $this->expectException(AssertionFailedError::class);
        $this->expectExceptionMessage('Failed asserting that the Browser does not have cookie "foo" with path "/path".');
        $this->getClientTester()->assertBrowserNotHasCookie('foo', '/path');
    }

    public function testAssertBrowserCookieValueSame()
    {
        $this->getClientTester()->assertBrowserCookieValueSame('foo', 'bar', false, '/path');
        $this->expectException(AssertionFailedError::class);
        $this->expectExceptionMessage('has cookie "foo" with path "/path" and has cookie "foo" with path "/path" with value "babar".');
        $this->getClientTester()->assertBrowserCookieValueSame('foo', 'babar', false, '/path');
    }

    public function testAssertSelectorExists()
    {
        $this->getCrawlerTester(new Crawler('<html><body><h1>'))->assertSelectorExists('body > h1');
        $this->expectException(AssertionFailedError::class);
        $this->expectExceptionMessage('matches selector "body > h1".');
        $this->getCrawlerTester(new Crawler('<html><head><title>Foo'))->assertSelectorExists('body > h1');
    }
Home | Imprint | This part of the site doesn't use cookies.