Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add ci tests for php 8.2, bump github actions versions (with phpstan fixed) #475

Merged
merged 1 commit into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
- name: Validate composer.json
Expand All @@ -19,7 +19,7 @@ jobs:
name: PHP-CS-Fixer
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -32,9 +32,15 @@ jobs:
fail-fast: false
matrix:
include:
- description: 'Symfony 6.3 DEV'
php: '8.2'
symfony: '6.3.*@dev'
- description: 'Symfony 6.2'
php: '8.2'
symfony: '6.2.*'
- description: 'Symfony 6.0'
php: '8.0'
symfony: '6.0.*@dev'
php: '8.1'
symfony: '6.0.*'
- description: 'Symfony 5.0'
php: '7.3'
symfony: '5.0.*'
Expand All @@ -50,9 +56,9 @@ jobs:
name: PHP ${{ matrix.php }} tests (${{ matrix.description }})
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: composer-${{ matrix.php }}-${{ matrix.symfony }}-${{ matrix.composer_option }}
Expand All @@ -68,7 +74,7 @@ jobs:
composer config prefer-stable true
if: matrix.beta
- name: remove cs-fixer for Symfony 6
if: contains(matrix.symfony, '6.0.*@dev')
if: contains(matrix.symfony, '6.3.*@dev')
run: |
composer remove --dev friendsofphp/php-cs-fixer pedrotroller/php-cs-custom-fixer --no-update
- run: composer update --prefer-dist --no-interaction --no-progress --ansi ${{ matrix.composer_option }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ vendor
bin
.php_cs.cache
.php-cs-fixer.cache
.phpunit.result.cache
.phpunit.cache
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
},
"require-dev": {
"phpunit/phpunit": "~7.4||~8.5",
"phpstan/phpstan": "^0.12.7",
"phpstan/phpstan-phpunit": "^0.12.6",
"phpstan/phpstan": "^1.0.0",
"phpstan/phpstan-phpunit": "^1.0.0",
"friendsofphp/php-cs-fixer": "^2.16||^3.0",
"pedrotroller/php-cs-custom-fixer": "^2.19"
},
Expand Down
9 changes: 6 additions & 3 deletions tests/Knp/Snappy/AbstractGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Knp\Snappy;

use Knp\Snappy\AbstractGenerator;
use Knp\Snappy\Exception\FileAlreadyExistsException;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use InvalidArgumentException;
Expand Down Expand Up @@ -40,6 +41,7 @@ public function testAddOption(): void
try {
$r->invokeArgs($media, ['baz', 'bat']);
$this->fail($message);
// @phpstan-ignore-next-line
} catch (InvalidArgumentException $e) {
$this->anything();
}
Expand Down Expand Up @@ -82,6 +84,7 @@ public function testAddOptions(): void
try {
$r->invokeArgs($media, [['bak' => 'bam', 'bah' => 'bap', 'baz' => 'bat']]);
$this->fail($message);
// @phpstan-ignore-next-line
} catch (InvalidArgumentException $e) {
$this->anything();
}
Expand Down Expand Up @@ -542,6 +545,7 @@ public function testMergeOptions(): void
try {
$r->invokeArgs($media, [['foo' => 'ban', 'bad' => 'bah']]);
$this->fail($message);
// @phpstan-ignore-next-line
} catch (InvalidArgumentException $e) {
$this->anything();
}
Expand Down Expand Up @@ -778,11 +782,10 @@ public function testIsAssociativeArray(array $array, bool $isAssociativeArray):
$this->assertEquals($isAssociativeArray, $r->invokeArgs($generator, [$array]));
}

/**
* @expectedException Knp\Snappy\Exception\FileAlreadyExistsException
*/
public function testItThrowsTheProperExceptionWhenFileExistsAndNotOverwritting(): void
{
$this->expectException(FileAlreadyExistsException::class);

$media = $this->getMockBuilder(AbstractGenerator::class)
->setMethods([
'configure',
Expand Down
1 change: 1 addition & 0 deletions tests/Knp/Snappy/PdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public function testRemovesLocalFilesOnError(): void
$this->assertEquals(1, \count($pdf->temporaryFiles));
$this->expectException(Error::class);
\trigger_error('test error', \E_USER_ERROR);
// @phpstan-ignore-next-line See https://github.com/phpstan/phpstan/issues/7799
$this->assertFileNotExists(\reset($pdf->temporaryFiles));
}

Expand Down