-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from Bee-Lab/upgrade-phpunit
⬆️ allow phpunit 10/11
- Loading branch information
Showing
7 changed files
with
61 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- https://phpunit.readthedocs.io/en/9.5/configuration.html --> | ||
<!-- https://docs.phpunit.de/en/10.5/configuration.html --> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd" | ||
backupGlobals="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
> | ||
<testsuites> | ||
<testsuite name="Project Test Suite"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<coverage> | ||
<source> | ||
<include> | ||
<directory>src</directory> | ||
</include> | ||
</coverage> | ||
</source> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,17 +26,11 @@ | |
abstract class WebTestCase extends SymfonyWebTestCase | ||
{ | ||
protected static ?EntityManagerInterface $em = null; | ||
|
||
protected static KernelBrowser $client; | ||
|
||
private ?AbstractFixture $fixture = null; | ||
|
||
protected static ?string $authUser = null; | ||
|
||
protected static ?string $authPw = null; | ||
|
||
/** @var ContainerInterface */ | ||
protected static $container; | ||
protected static ?ContainerInterface $container = null; | ||
|
||
protected function setUp(): void | ||
{ | ||
|
@@ -64,15 +58,13 @@ protected function setUp(): void | |
|
||
protected function tearDown(): void | ||
{ | ||
if (null !== self::$em) { | ||
self::$em->getConnection()->close(); | ||
} | ||
self::$em?->getConnection()->close(); | ||
parent::tearDown(); | ||
} | ||
|
||
/** | ||
* Save request output and show it in the browser | ||
* See http://giorgiocefaro.com/blog/test-symfony-and-automatically-open-the-browser-with-the-response-content | ||
* See https://web.archive.org/web/20190205012632/https://giorgiocefaro.com/blog/test-symfony-and-automatically-open-the-browser-with-the-response-content | ||
* You can define a "domain" parameter with the current domain of your app. | ||
*/ | ||
protected static function saveOutput(bool $delete = true): void | ||
|
@@ -104,7 +96,7 @@ protected static function saveOutput(bool $delete = true): void | |
* | ||
* @throws \InvalidArgumentException | ||
*/ | ||
protected static function login(string $username = '[email protected]', string $firewall = null, string $service = null): void | ||
protected static function login(string $username = '[email protected]', ?string $firewall = null, ?string $service = null): void | ||
{ | ||
$service ??= static::$container->getParameter('beelab_test.user_service'); | ||
$object = static::$container->get($service); | ||
|
@@ -180,13 +172,13 @@ protected static function getTxtFile(string $file = '0'): UploadedFile | |
* | ||
* @param array<int, string> $fixtures e.g. ['UserData', 'OrderData'] | ||
* | ||
* @throws \Doctrine\DBAL\DBALException | ||
* @throws \Doctrine\DBAL\Exception | ||
* @throws \InvalidArgumentException | ||
*/ | ||
protected function loadFixtures( | ||
array $fixtures, | ||
string $namespace = 'App\\DataFixtures\\ORM\\', | ||
string $managerService = null, | ||
?string $managerService = null, | ||
bool $append = false, | ||
): void { | ||
if (null !== $managerService) { | ||
|
@@ -238,7 +230,7 @@ protected static function commandTest( | |
Command $command, | ||
array $arguments = [], | ||
array $otherCommands = [], | ||
array $inputs = null, | ||
?array $inputs = null, | ||
): string { | ||
$application = new Application(self::$client->getKernel()); | ||
$application->add($command); | ||
|
@@ -307,15 +299,15 @@ protected static function setSessionException(string $msg = 'error...'): void | |
self::$client->getCookieJar()->set($cookie); | ||
} | ||
|
||
protected static function clickLinkByData(string $dataName, string $parent = null): Crawler | ||
protected static function clickLinkByData(string $dataName, ?string $parent = null): Crawler | ||
{ | ||
$selector = (null === $parent ? '' : $parent.' ').'a[data-'.$dataName.']'; | ||
$linkNode = self::$client->getCrawler()->filter($selector); | ||
|
||
return self::$client->click($linkNode->link()); | ||
} | ||
|
||
protected static function clickLinkBySelectorText(string $linkText, string $parent = null): Crawler | ||
protected static function clickLinkBySelectorText(string $linkText, ?string $parent = null): Crawler | ||
{ | ||
$selector = (null === $parent ? '' : $parent.' ').'a:contains("'.$linkText.'")'; | ||
$linkNode = self::$client->getCrawler()->filter($selector); | ||
|
Oops, something went wrong.