-
Notifications
You must be signed in to change notification settings - Fork 116
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
4.next: add PHPUnit 11 support #736
Conversation
use Migrations\Db\Table\Index; | ||
use Migrations\Db\Table\Table; | ||
|
||
trait DefaultPdoAdapterTrait |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a few places where we need a custom PDO instance which only returns specific values in specific cases. So I just added this trait to more easily make it possible to "mock" those instances without having to re-define all those methods.
The tests failing for MySQL indicates, that the changes in the Current 4.next of this repo is running fine: https://github.com/cakephp/migrations/actions/runs/10326114754 |
I found the Problem: inside our I remember there was something related to how plugins are loaded inside tests so the easiest fix was to load that test plugin inside that specific mysql test. And I guess this doesn't fail for the other DBMS's because we don't have the same test for the other versions. |
$this->adapter = new class (['foo' => 'bar', 'version_order' => Config::VERSION_ORDER_CREATION_TIME]) extends PdoAdapter { | ||
use DefaultPdoAdapterTrait; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 This will be easier to maintain than phpunit mocks have been.
This has caused problems in the past as well. But scanning plugins that aren't loaded isn't something we do generally. I think the correct solution is to update the tests as you've done. |
This is a huge PR, so i tried to split things up via the commits:
Part 1: Fix PHPUnit Deprecations and convert mock classes to anonymous classes
Part 2: Fix small Migration specific deprecations
Part 3: Transform DataProviders and remove all
Covers
annotationsPart 4: Fix
Depends
annotationsI also noticed, that our CS fixer doesn't care / automatically fix annotations if they are written like this so this is something for our CS-Fixer