-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
PHPUnit\Framework\TestCase::__constructor marked as internal even though it's intended to be used #3975
Comments
Just found another one:
|
I do not know where you get the idea that |
It's not used directly, but the ctor is invoked just by extending |
Just as dkarlovi said, how am I supposed to extend the Testcase, if the extended class needs its own constructor (and thus parent::constructor(); is unavoidable) |
After upgrading PHPUnit from 9 to 10, I started getting errors about not having enough arguments for the constructor, when trying to extend class MyTest extends TestCase {
public function __construct($name = '') {
parent::__construct($name);
}
public function test() {
//do a test
}
} Why can't the Another way I get around this instead of declaring the constructor, is explicitly passing a -$mytest = new MyTest;
+$mytest = new MyTest( 'MyTest' ); Of what use is the required |
Summary
Method
PHPUnit\Framework\TestCase::__constructor
is marked as internal with this message:Current behavior
Method is marked as internal, seemingly just to signal it not being covered by BC.
But it's not actually internal since it's intended to be used by the fast you extend
TestCase
in your own suites.The usage of internal methods is reported by running Psalm on your tests:
How to reproduce
Run Psalm on your tests backed by PHPUnit 8.5.0.
Expected behavior
Method(s) which are intended to be used by the tests shouldn't be marked as internal.
The text was updated successfully, but these errors were encountered: