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

extracted ClassTypeDetector to ease re-use #64

Merged
merged 1 commit into from
Jun 26, 2023

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Jun 26, 2023

preparation for #49

also fixes compat with older phpunit versions when PHPUnit_Framework_TestCase is used

$classReflection = $scope->getClassReflection();
if ($classReflection instanceof ClassReflection && $classReflection->isSubclassOf(
'PHPUnit\Framework\TestCase'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before this PR, this check was missing PHPUnit_Framework_TestCase

@@ -14,17 +14,24 @@ final class PublicClassMethodMatcher
* @var string[]
*/
private const SKIPPED_TYPES = [
'PHPUnit\Framework\TestCase',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before this PR, this check was missing PHPUnit_Framework_TestCase

@staabm staabm marked this pull request as ready for review June 26, 2023 15:39

final class ClassTypeDetector
{
public function isTestClass(ClassReflection $classReflection): bool
Copy link
Contributor Author

@staabm staabm Jun 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after this PR, it will also be easier to integrate other test-frameworks, which use different base-classes.

just a matter of adjusting a single method in the repo as of now.

@TomasVotruba
Copy link
Owner

Thank you, I like this improvement 👍

@TomasVotruba TomasVotruba merged commit 46d3aab into TomasVotruba:main Jun 26, 2023
8 checks passed
@staabm staabm deleted the refac2 branch June 26, 2023 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants