Skip to content

Commit

Permalink
Amend based on feedback from #807.
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Jun 9, 2023
1 parent 11edab0 commit 3c971d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ public function getValidatorConfig(): array
*/
public function getCachesConfig(): array
{
$defaultOptions = [
'namespace' => 'DoctrineModule',
'key_pattern' => '/^[a-z0-9_\+\-\[\]\\\\$#]*$/Di',
];
$defaultOptions = ['namespace' => 'DoctrineModule'];

return [
'doctrinemodule.cache.apcu' => [
Expand All @@ -133,7 +130,11 @@ public function getCachesConfig(): array
],
'doctrinemodule.cache.filesystem' => [
'adapter' => 'filesystem',
'options' => $defaultOptions + ['cache_dir' => 'data/DoctrineModule/cache'],
'options' => $defaultOptions + [
'cache_dir' => 'data/DoctrineModule/cache',
// We need to be slightly less restrictive than Filesystem defaults:
'key_pattern' => '/^[a-z0-9_\+\-\[\]\\\\$#]*$/Di',
],
'plugins' => [['name' => 'serializer']],
],
'doctrinemodule.cache.memcached' => [
Expand Down
4 changes: 2 additions & 2 deletions tests/ConfigProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function testInvokeHasCorrectKeys(): void

public function testDoctrineCompatibleCacheKeyConfiguration(): void
{
$config = (new ConfigProvider())->getCachesConfig()['doctrinemodule.cache.array'];
$adapter = new \Laminas\Cache\Storage\Adapter\Memory($config['options']);
$config = (new ConfigProvider())->getCachesConfig()['doctrinemodule.cache.filesystem'];

Check failure on line 42 in tests/ConfigProviderTest.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.1)

Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
$adapter = new \Laminas\Cache\Storage\Adapter\Filesystem($config['options']);

Check failure on line 43 in tests/ConfigProviderTest.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.1)

Class \Laminas\Cache\Storage\Adapter\Filesystem should not be referenced via a fully qualified name, but via a use statement.
$key = 'MyTestKey[something\inside\here#with$specialChars]';

Check failure on line 44 in tests/ConfigProviderTest.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.1)

Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
$adapter->setItem($key, 'foo');
$this->assertEquals('foo', $adapter->getItem($key));
Expand Down

0 comments on commit 3c971d0

Please sign in to comment.