Skip to content

Commit

Permalink
Added support for test suite to use PHPUnit 10
Browse files Browse the repository at this point in the history
  • Loading branch information
code-distortion committed Dec 1, 2023
1 parent bb7a135 commit 35ed067
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 32 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"require-dev": {
"jchook/phpunit-assert-throws": "^1.0",
"phpstan/phpstan": "^0.9 | ^0.10 | ^0.11 | ^0.12 | ^1.0",
"phpunit/phpunit": "~4.8 | ^5.0 | ^6.0 | ^7.0 | ^8.0 | ^9.0",
"phpunit/phpunit": "~4.8 | ^5.0 | ^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0",
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
Expand Down
24 changes: 24 additions & 0 deletions phpunit.up-to-9.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Integration">
<directory suffix="Test.php">./tests/Integration</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
</report>
</coverage>
</phpunit>
48 changes: 22 additions & 26 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="true"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<logging>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheDirectory="phpunit/cache"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<html outputDirectory="phpunit/coverage"/>
</report>
</coverage>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
10 changes: 5 additions & 5 deletions tests/Unit/FluentDotEnvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function newFluentDotEnv()
*
* @return array[]
*/
public function CanImportProperlyDataProvider()
public static function CanImportProperlyDataProvider()
{
$notImported = [
'UNTOUCHED_KEY' => 'untouched-value',
Expand Down Expand Up @@ -531,7 +531,7 @@ function () use (&$fDotEnv, $useSafeLoad, $envFilename) {
*
* @return array[]
*/
public function CanCallMethodsInDifferentWaysDataProvider()
public static function CanCallMethodsInDifferentWaysDataProvider()
{
$imported = [
'INITIAL_KEY' => 'override-value',
Expand Down Expand Up @@ -932,7 +932,7 @@ function () use (&$fDotEnv) {
*
* @return array[]
*/
public function canCallValidationAfterLoadDataProvider()
public static function canCallValidationAfterLoadDataProvider()
{
$validCallback = function (string $key, $value) {
return true;
Expand Down Expand Up @@ -1230,7 +1230,7 @@ function () {
*
* @return array[]
*/
public function canCastProperlyDataProvider()
public static function canCastProperlyDataProvider()
{
$boolean = [
'true' => true,
Expand Down Expand Up @@ -1299,7 +1299,7 @@ public function can_cast_properly(string $castMethod, string $key, $expected)
*
* @return array[]
*/
public function canGetMultipleValuesDataProvider()
public static function canGetMultipleValuesDataProvider()
{
return [
// GET
Expand Down

0 comments on commit 35ed067

Please sign in to comment.