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

tests[ORMSetupTest]: testCacheNamespaceShouldBeGeneratedForApcu requires enabled apc #10940

Merged
merged 1 commit into from
Sep 10, 2023

Conversation

kaznovac
Copy link
Contributor

fix test flakiness

the apcu extension is required but if not enabled (e.g. apc.enable_cli default is 0 https://www.php.net/manual/en/apcu.configuration.php) the ORMSetup utility will choose other Cache adapters (see

private static function createCacheInstance(
bool $isDevMode,
string $proxyDir,
?CacheItemPoolInterface $cache
): CacheItemPoolInterface {
if ($cache !== null) {
return $cache;
}
if (! class_exists(ArrayAdapter::class)) {
throw new RuntimeException(
'The Doctrine setup tool cannot configure caches without symfony/cache.'
. ' Please add symfony/cache as explicit dependency or pass your own cache implementation.'
);
}
if ($isDevMode) {
return new ArrayAdapter();
}
$namespace = 'dc2_' . md5($proxyDir);
if (extension_loaded('apcu') && apcu_enabled()) {
return new ApcuAdapter($namespace);
}
if (MemcachedAdapter::isSupported()) {
return new MemcachedAdapter(MemcachedAdapter::createConnection('memcached://127.0.0.1'), $namespace);
}
if (extension_loaded('redis')) {
$redis = new Redis();
$redis->connect('127.0.0.1');
return new RedisAdapter($redis, $namespace);
}
return new ArrayAdapter();
}
)

…res enabled apc

fix test flakiness

the `apcu` extension is required but if not enabled (e.g. `apc.enable_cli` default is `0` https://www.php.net/manual/en/apcu.configuration.php) the `ORMSetup` utility will choose other Cache adapters (see https://github.com/doctrine/orm/blob/9f555ea8fb4f7ae9a362285dc71e85776a1c5cc3/lib/Doctrine/ORM/ORMSetup.php#L180-L218)
@derrabus derrabus added this to the 2.16.3 milestone Sep 10, 2023
@derrabus derrabus merged commit 858b01f into doctrine:2.16.x Sep 10, 2023
@kaznovac kaznovac deleted the patch-2 branch September 10, 2023 21:34
derrabus added a commit to derrabus/orm that referenced this pull request Sep 29, 2023
* 2.16.x:
  PHPStan 1.10.35, Psalm 5.15.0 (doctrine#10958)
  docs: in text, refer to attributes when talking about metadata (doctrine#10956)
  Fix bullet list layout (doctrine#10951)
  docs[query-builder]: fix rendering of `Doctrine\DBAL\ParameterType::*` (doctrine#10945)
  tests[ORMSetupTest]: testCacheNamespaceShouldBeGeneratedForApcu requires enabled apc (doctrine#10940)
  docs: use modern named arguments syntax
  Ignore "Unknown directive" error
  Use a stable release
  Remove output directory argument
  tutorials[getting-started]: example fix bug id type definition
  Verify UnitOfWork::HINT_DEFEREAGERLOAD exists and is true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants