[FrameworkBundle] Fix BrowserKit assertions to make them compatible with Panther
This commit is contained in:
parent
58439e3166
commit
2316dc36fb
@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Test;
|
|||||||
|
|
||||||
use PHPUnit\Framework\Constraint\LogicalAnd;
|
use PHPUnit\Framework\Constraint\LogicalAnd;
|
||||||
use PHPUnit\Framework\Constraint\LogicalNot;
|
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\BrowserKit\Test\Constraint as BrowserKitConstraint;
|
||||||
use Symfony\Component\DomCrawler\Crawler;
|
use Symfony\Component\DomCrawler\Crawler;
|
||||||
use Symfony\Component\DomCrawler\Test\Constraint as DomCrawlerConstraint;
|
use Symfony\Component\DomCrawler\Test\Constraint as DomCrawlerConstraint;
|
||||||
@ -186,7 +186,7 @@ trait WebTestAssertionsTrait
|
|||||||
self::assertThat(self::getRequest(), $constraint, $message);
|
self::assertThat(self::getRequest(), $constraint, $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function getClient(KernelBrowser $newClient = null): ?KernelBrowser
|
private static function getClient(AbstractBrowser $newClient = null): ?AbstractBrowser
|
||||||
{
|
{
|
||||||
static $client;
|
static $client;
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ trait WebTestAssertionsTrait
|
|||||||
return $client = $newClient;
|
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__));
|
static::fail(sprintf('A client must be set to make assertions on it. Did you forget to call "%s::createClient()"?', __CLASS__));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ final class CrawlerSelectorAttributeValueSame extends Constraint
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->expectedText === trim($crawler->getNode(0)->getAttribute($this->attribute));
|
return $this->expectedText === trim($crawler->attr($this->attribute));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user