Skip to content

Commit cd306fc

Browse files
Fix tests on PHP 8.3/8.4
PHPUnit uses attributes now
1 parent cb7a929 commit cd306fc

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

.github/workflows/test.yml

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14+
- name: Test PHP 8.4
15+
run: make test PHP=8.4
16+
- name: Test PHP 8.3
17+
run: make test PHP=8.3
1418
- name: Test PHP 8.2
1519
run: make test PHP=8.2
1620
- name: Test PHP 8.1

makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test:
1212
for VOLUME in $$(echo "$(VOLUME_BINDS)" | tr "," "\n"); do VOLUMES="$$VOLUMES -v $$(pwd)/$$VOLUME:/var/www/$$VOLUME"; done;\
1313
VERSION=$$(echo "$(PHP)-cli" | sed "s/^-//");\
1414
test $$(docker images -q matthiasmullie/minify:$$VERSION) || docker build -t matthiasmullie/minify:$$VERSION . --build-arg VERSION=$$VERSION;\
15-
docker run $$VOLUMES matthiasmullie/minify:$$VERSION env XDEBUG_MODE=coverage vendor/bin/phpunit $(TEST) --coverage-clover build/coverage-$(PHP)-$(TEST).clover
15+
docker run $$VOLUMES matthiasmullie/minify:$$VERSION env XDEBUG_MODE=coverage vendor/bin/phpunit $(TEST) --coverage-clover build/coverage-$(PHP)-$(TEST).clover --configuration=phpunit.xml
1616

1717
format:
1818
VOLUMES=""

phpunit.xml

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
colors="true"
5+
bootstrap="tests/bootstrap.php"
6+
displayDetailsOnTestsThatTriggerDeprecations="true"
7+
displayDetailsOnTestsThatTriggerErrors="true"
8+
displayDetailsOnTestsThatTriggerNotices="true"
9+
displayDetailsOnTestsThatTriggerWarnings="true"
10+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
11+
>
312
<coverage>
413
<report>
514
<clover outputFile="build/coverage.clover"/>

tests/CSS/CSSTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace MatthiasMullie\Minify\Tests\CSS;
44

55
use MatthiasMullie\Minify\Tests\CompatTestCase;
6+
use PHPUnit\Framework\Attributes\DataProvider;
67

78
/**
89
* CSS minifier test case.
@@ -21,6 +22,7 @@ protected function getMinifier()
2122
*
2223
* @dataProvider dataProvider
2324
*/
25+
#[DataProvider('dataProvider')]
2426
public function testMinify($input, $expected)
2527
{
2628
$minifier = $this->getMinifier();
@@ -34,6 +36,7 @@ public function testMinify($input, $expected)
3436
*
3537
* @dataProvider dataProviderPaths
3638
*/
39+
#[DataProvider('dataProviderPaths')]
3740
public function testConvertRelativePath($source, $target, $expected)
3841
{
3942
$minifier = $this->getMinifier();

tests/JS/JSTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace MatthiasMullie\Minify\Tests\JS;
44

55
use MatthiasMullie\Minify\Tests\CompatTestCase;
6+
use PHPUnit\Framework\Attributes\DataProvider;
67

78
/**
89
* JS minifier test case.
@@ -45,6 +46,7 @@ public function testAddFile()
4546
*
4647
* @dataProvider dataProvider
4748
*/
49+
#[DataProvider('dataProvider')]
4850
public function testMinify($input, $expected)
4951
{
5052
$minifier = $this->getMinifier();

0 commit comments

Comments
 (0)