Skip to content

Commit

Permalink
support symfony 6
Browse files Browse the repository at this point in the history
  • Loading branch information
jwong-dayspring committed Feb 17, 2024
1 parent c9ec29e commit 10ab00a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 42 deletions.
8 changes: 4 additions & 4 deletions Framework/Test/ServiceTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static private function getPhpUnitCliConfigArgument()
*/
static protected function getKernelClass()
{
$dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : static::getPhpUnitXmlDir();
$dir = $_SERVER['KERNEL_DIR'] ?? static::getPhpUnitXmlDir();

$finder = new Finder();
$finder->name('*Kernel.php')->depth(0)->in($dir);
Expand Down Expand Up @@ -123,15 +123,15 @@ static protected function getKernelClass()
*
* @return HttpKernelInterface A HttpKernelInterface instance
*/
static protected function createKernel(array $options = array())
static protected function createKernel(array $options = [])
{
if (null === static::$class) {
static::$class = static::getKernelClass();
}

return new static::$class(
isset($options['environment']) ? $options['environment'] : 'test',
isset($options['debug']) ? $options['debug'] : true
$options['environment'] ?? 'test',
$options['debug'] ?? true
);
}

Expand Down
7 changes: 3 additions & 4 deletions Tests/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ public function getRootDir()
{
return __DIR__.'/Resources';
}
public function registerBundles()
public function registerBundles(): iterable
{
return array(
);
return [];
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/Resources/config/config_test.yml');
if (class_exists('Symfony\Component\Asset\Package')) {
$loader->load(function (ContainerBuilder $container) {
$container->loadFromExtension('framework', array('assets' => array()));
$container->loadFromExtension('framework', ['assets' => []]);
});
}
}
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
],
"require": {
"php": ">=7.4",
"symfony/http-kernel": "^4.4.12|^5.0",
"symfony/http-kernel": "^4.4.12|^5.0|^6.0",
"phpunit/phpunit": "^8.5.23|^9.0"
},
"require-dev": {
"symfony/config": "^4.4.12|^5.0",
"symfony/dependency-injection": "^4.4.12|^5.0",
"symfony/yaml": "^4.4.12|^5.0"
"symfony/config": "^4.4.12|^5.0|^6.0",
"symfony/dependency-injection": "^4.4.12|^5.0|^6.0",
"symfony/yaml": "^4.4.12|^5.0|^6.0",
"rector/rector": "^0.19.0"
},
"autoload": {
"psr-4": {
Expand Down
56 changes: 26 additions & 30 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="Tests/autoload.php">

<php>
<ini name="error_reporting" value="-1"/>
<server name="KERNEL_DIR" value="./Tests/" />
</php>

<testsuites>
<testsuite name="ServiceTestHelper Test Suite">
<directory suffix="Test.php">./Tests</directory>
</testsuite>
</testsuites>

<logging>
<log type="junit" target="build/logs/junit.xml"
logIncompleteSkipped="false"/>
</logging>

<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./Tests</directory>
<directory>./vendor</directory>
<directory>./Resources</directory>
</exclude>
</whitelist>
</filter>
bootstrap="Tests/autoload.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./Tests</directory>
<directory>./vendor</directory>
<directory>./Resources</directory>
</exclude>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
<server name="KERNEL_DIR" value="./Tests/"/>
</php>
<testsuites>
<testsuite name="ServiceTestHelper Test Suite">
<directory suffix="Test.php">./Tests</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="build/logs/junit.xml"/>
</logging>
</phpunit>

0 comments on commit 10ab00a

Please sign in to comment.