-
-
Notifications
You must be signed in to change notification settings - Fork 452
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
Fix second level cache compatibility layer #1365
Conversation
// Disabled to prevent changing the comment below to a single-line annotation | ||
// phpcs:disable SlevomatCodingStandard.Commenting.RequireOneLineDocComment.MultiLineDocComment | ||
|
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.
PHPUnit does not seem to understand one-line annotations, so we need to disable the sniff to avoid phpcbf changing this back.
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.
can we instead disable that sniff for the whole Tests folder through the config, to avoid introducing similar issues in the future when using PHPUnit annotations on other tests ?
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.
I would rather bug was fixed in phpunit
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.
long term, indeed.
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.
Fixed in sebastianbergmann/phpunit#4693 , thanks @ostrolucky !
@@ -735,7 +850,7 @@ public function testSecondLevelCache(): void | |||
$this->assertDICDefinitionClass($myEntityRegionDef, '%doctrine.orm.second_level_cache.default_region.class%'); | |||
$this->assertDICDefinitionClass($loggerChainDef, '%doctrine.orm.second_level_cache.logger_chain.class%'); | |||
$this->assertDICDefinitionClass($loggerStatisticsDef, '%doctrine.orm.second_level_cache.logger_statistics.class%'); | |||
$this->assertDICDefinitionClass($cacheDriverDef, ArrayAdapter::class); | |||
$this->assertDICDefinitionClass($cacheDriverDef, CacheProvider::class); |
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.
On second thought, having to change this should probably have alerted us to the bug. Oh well 🤷♂️
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.
LGTM 👍
// Disabled to prevent changing the comment below to a single-line annotation | ||
// phpcs:disable SlevomatCodingStandard.Commenting.RequireOneLineDocComment.MultiLineDocComment | ||
|
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.
I would rather bug was fixed in phpunit
Fixes #1364.
Our compatibility layer forgot to take into account second-level caches, which aren't set on the configuration directly but rather in a separate factory. This PR fixes this issue and adds a functional test that fetches an entity manager for each cache configuration we have: for each metadata, query, result, and second-level cache we test with the pool, psr-6 service, and doctrine/cache type. For metadata, we also test without a metadata cache configured.