Skip to content

Add support for DomCrawler's PHPUnit assertions #205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 21, 2019

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Jun 28, 2019

Allow to use all DomCrawler assertions introduced in Symfony 4.3 with Panther.

Example:

<?php

class AssertionsTest extends PantherTestCase
{
    public function testDomCrawlerAssertions(): void
    {
        self::createPantherClient()->request('GET', '/basic.html');
        $this->assertSelectorExists('.p-1');
        $this->assertSelectorNotExists('#notexist');
        $this->assertSelectorTextContains('body', 'P1');
        $this->assertSelectorTextSame('.p-1', 'P1');
        $this->assertSelectorTextNotContains('.p-1', 'not contained');
        $this->assertPageTitleSame('A basic page');
        $this->assertPageTitleContains('A basic');
        $this->assertInputValueNotSame('in', '');
        $this->assertInputValueSame('in', 'test');
    }
}

Requires symfony/symfony#32207.

@dunglas
Copy link
Member Author

dunglas commented Aug 21, 2019

Needs symfony/symfony#33278

@dunglas dunglas force-pushed the support-assertions branch from d934d3c to 1c2013a Compare August 21, 2019 20:47
@dunglas dunglas merged commit b9225b0 into symfony:master Aug 21, 2019
@dunglas dunglas deleted the support-assertions branch August 21, 2019 21:06
dunglas added a commit that referenced this pull request Dec 28, 2020
* Add support for DomCrawler PHPUnit assertions

* Support all versions of WebTestCase

* Fix test

* CS

* Fix PHPStan

* Fix CS
nicolas-grekas pushed a commit that referenced this pull request Jan 18, 2021
* Add support for DomCrawler PHPUnit assertions

* Support all versions of WebTestCase

* Fix test

* CS

* Fix PHPStan

* Fix CS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant