Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] Fix BrowserKit assertions to make them compatible with Panther #33278

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 1 commit into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use PHPUnit\Framework\Constraint\LogicalAnd;
use PHPUnit\Framework\Constraint\LogicalNot;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Component\BrowserKit\AbstractBrowser;
use Symfony\Component\BrowserKit\Test\Constraint as BrowserKitConstraint;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\DomCrawler\Test\Constraint as DomCrawlerConstraint;
Expand Down Expand Up @@ -186,15 +186,15 @@ public static function assertRouteSame($expectedRoute, array $parameters = [], s
self::assertThat(self::getRequest(), $constraint, $message);
}

private static function getClient(KernelBrowser $newClient = null): ?KernelBrowser
private static function getClient(AbstractBrowser $newClient = null): ?AbstractBrowser
{
static $client;

if (0 < \func_num_args()) {
return $client = $newClient;
}

if (!$client instanceof KernelBrowser) {
if (!$client instanceof AbstractBrowser) {
static::fail(sprintf('A client must be set to make assertions on it. Did you forget to call "%s::createClient()"?', __CLASS__));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function matches($crawler): bool
return false;
}

return $this->expectedText === trim($crawler->getNode(0)->getAttribute($this->attribute));
return $this->expectedText === trim($crawler->attr($this->attribute));
}

/**
Expand Down