Skip to content

Commit

Permalink
Split off the phpstan tests again
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jul 11, 2024
1 parent 0613a55 commit f457867
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ jobs:
composer update ${{ env.COMPOSER_FLAGS }}
- name: "Run tests"
run: "vendor/bin/phpunit"
run: |
vendor/bin/phpunit
vendor/bin/phpunit --group phpstan
6 changes: 6 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
</testsuite>
</testsuites>

<groups>
<exclude>
<group>phpstan</group>
</exclude>
</groups>

<filter>
<whitelist>
<directory>src</directory>
Expand Down
10 changes: 3 additions & 7 deletions tests/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function doExpectWarning(string $message): void

protected function expectPcreEngineException(string $pattern): void
{
$error = function_exists('preg_last_error_msg') ? 'Backtrack limit exhausted' : 'PREG_BACKTRACK_LIMIT_ERROR';
$error = PHP_VERSION_ID >= 80000 ? 'Backtrack limit exhausted' : 'PREG_BACKTRACK_LIMIT_ERROR';
$this->expectPcreException($pattern, $error);
}

Expand All @@ -49,18 +49,14 @@ protected function expectPcreException(string $pattern, ?string $error = null):

if (null === $error) {
// Only use a message if the error can be reliably determined
if (function_exists('preg_last_error_msg')) {
if (PHP_VERSION_ID >= 80000) {
$error = 'Internal error';
} else {
$error = 'PREG_INTERNAL_ERROR';
}
}

if (null !== $error) {
$message = sprintf('%s: failed executing "%s": %s', $this->pregFunction, $pattern, $error);
} else {
$message = null;
}
$message = sprintf('%s: failed executing "%s": %s', $this->pregFunction, $pattern, $error);

$this->doExpectException('Composer\Pcre\PcreException', $message);
}
Expand Down
7 changes: 7 additions & 0 deletions tests/PHPStanTests/TypeInferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@

use PHPStan\Testing\TypeInferenceTestCase;

/**
* Run with "vendor/bin/phpunit --group phpstan"
*
* This is excluded by default to avoid side effects with the library tests
*
* @group phpstan
*/
class TypeInferenceTest extends TypeInferenceTestCase
{
/**
Expand Down

0 comments on commit f457867

Please sign in to comment.