Skip to content

Commit 97171a2

Browse files
committed
Upgrade PHPUnit
1 parent 9563867 commit 97171a2

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

.github/workflows/tests.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,20 @@ jobs:
4848

4949
- name: Set PHPUnit version
5050
if: matrix.php >= 8.1
51-
run: composer require "phpunit/phpunit:^8.5.41" --no-update
51+
run: composer require "phpunit/phpunit:^9.6.22" --no-update
5252

5353
- name: Install Dependencies
5454
run: composer update --prefer-dist --prefer-${{ matrix.setup }} --no-interaction --no-suggest
5555

56+
- name: Run Tests with coverage
57+
if: matrix.php == 8.4 && matrix.setup == 'stable'
58+
run: vendor/bin/phpunit --coverage-clover=clover.xml --coverage-text --log-junit=test-results.xml
59+
5660
- name: Run Tests
57-
run: vendor/bin/phpunit ${{ matrix.php == 8.4 && matrix.setup == 'stable' && '--coverage-clover=clover.xml --coverage-text --log-junit test-results.xml' || '' }}
61+
if: matrix.php != 8.4 || matrix.setup != 'stable'
62+
run: vendor/bin/phpunit --log-junit=test-results.xml
5863

5964
- name: Upload Test Results
60-
if: matrix.php == 8.4 && matrix.setup == 'stable'
6165
uses: actions/upload-artifact@v4
6266
with:
6367
name: "${{ matrix.php-version }}-phpunit-results"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"nesbot/carbon": "^2.72.6 || ^3.0"
1818
},
1919
"require-dev": {
20-
"phpunit/phpunit": "^7.5.20 || ^8.5.41"
20+
"phpunit/phpunit": "^7.5.20 || ^8.5.41 || ^9.6.22"
2121
},
2222
"autoload": {
2323
"psr-4": {

tests/Carbon/Types/GeneratorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ public function testGetMethodSourceCode()
5858
$foo = new ReflectionMethod(get_class($object), 'foo');
5959

6060
$sourceCode = $method->invoke($generator, $foo);
61+
$match = (preg_match('/public function foo\(\)\s*\{\s*return \'hello\';/', $sourceCode) > 0);
6162

62-
$this->assertRegExp('/public function foo\(\)\s*\{\s*return \'hello\';/', $sourceCode);
63+
$this->assertTrue($match, 'Source code must contain foo method returning "hello".');
6364
}
6465

6566
/**

0 commit comments

Comments
 (0)