Skip to content

Commit

Permalink
psalm - hotfix analyzing old phpunit testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenekdrahos committed May 14, 2021
1 parent 87504c9 commit 8f254ea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/.ci/.phpqa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ phpqa:
# Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(/home/travis/build/EdgedesignCZ/phpqa/phpqa/):
# failed to open dir: No such file or directory
# https://travis-ci.org/EdgedesignCZ/phpqa/jobs/558458320#L799
ignoredFiles: tests/.phpunit/fix-psalm-testcase.php
tools:
- phpmetrics:0
- phploc
Expand Down
10 changes: 10 additions & 0 deletions tests/.phpunit/fix-psalm-testcase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace
{
use PHPUnit\Framework\TestCase;

abstract class PHPUnit_Framework_TestCase extends TestCase
{
}
}
6 changes: 5 additions & 1 deletion tests/.phpunit/fix-testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@

$legacyTestClass = 'PHPUnit_Framework_TestCase';
if (!class_exists($legacyTestClass)) {
class_alias('PHPUnit\Framework\TestCase', $legacyTestClass);
// `class_alias('PHPUnit\Framework\TestCase', $legacyTestClass);` does not work for psalm:
// > Could not get class storage for phpunit_framework_testcase"
// > https://github.com/EdgedesignCZ/phpqa/runs/2581795905?check_suite_focus=true#step:7:246
// > https://github.com/psalm/psalm-plugin-phpunit/issues/30#issuecomment-485485187
include_once(__DIR__ . "/fix-psalm-testcase.php");
}

0 comments on commit 8f254ea

Please sign in to comment.