From fd0d002174fba4e0b5461bf0ebbfce96bda36274 Mon Sep 17 00:00:00 2001 From: Marc Bennewitz Date: Fri, 22 Apr 2016 22:35:54 +0200 Subject: [PATCH] fixed #97 by adding underline names to plugin manager + added some MixedCASE versions where it makes sense (like APCu, ZendServerSHM ...) --- src/Storage/AdapterPluginManager.php | 87 +++++++++++-------- src/Storage/PluginManager.php | 32 ++++--- test/Pattern/CallbackCacheTest.php | 8 ++ test/Pattern/CaptureCacheTest.php | 8 ++ test/Pattern/ClassCacheTest.php | 8 ++ test/Pattern/CommonPatternTest.php | 20 +++++ test/Pattern/ObjectCacheTest.php | 8 ++ test/Pattern/OutputCacheTest.php | 8 ++ test/Storage/Adapter/AbstractDbaTest.php | 9 ++ test/Storage/Adapter/ApcTest.php | 8 ++ test/Storage/Adapter/ApcuTest.php | 10 +++ test/Storage/Adapter/BlackHoleTest.php | 27 ++++++ test/Storage/Adapter/CommonAdapterTest.php | 19 ++++ test/Storage/Adapter/FilesystemTest.php | 8 ++ test/Storage/Adapter/MemcacheTest.php | 8 ++ test/Storage/Adapter/MemcachedTest.php | 8 ++ test/Storage/Adapter/MemoryTest.php | 8 ++ test/Storage/Adapter/MongoDbTest.php | 10 +++ test/Storage/Adapter/RedisTest.php | 8 +- test/Storage/Adapter/SessionTest.php | 8 ++ test/Storage/Adapter/WinCacheTest.php | 10 +++ test/Storage/Adapter/XCacheTest.php | 10 +++ test/Storage/Adapter/ZendServerDiskTest.php | 10 +++ test/Storage/Adapter/ZendServerShmTest.php | 12 +++ .../Plugin/ClearExpiredByFactorTest.php | 10 +++ test/Storage/Plugin/CommonPluginTest.php | 20 +++++ test/Storage/Plugin/ExceptionHandlerTest.php | 10 +++ test/Storage/Plugin/IgnoreUserAbortTest.php | 10 +++ test/Storage/Plugin/OptimizeByFactorTest.php | 10 +++ test/Storage/Plugin/SerializerTest.php | 8 ++ 30 files changed, 367 insertions(+), 53 deletions(-) diff --git a/src/Storage/AdapterPluginManager.php b/src/Storage/AdapterPluginManager.php index 3f3b907a2..8db14be50 100644 --- a/src/Storage/AdapterPluginManager.php +++ b/src/Storage/AdapterPluginManager.php @@ -24,44 +24,55 @@ class AdapterPluginManager extends AbstractPluginManager { protected $aliases = [ - 'apc' => Adapter\Apc::class, - 'Apc' => Adapter\Apc::class, - 'apcu' => Adapter\Apcu::class, - 'ApcU' => Adapter\Apcu::class, - 'Apcu' => Adapter\Apcu::class, - 'APCu' => Adapter\Apcu::class, - 'blackhole' => Adapter\BlackHole::class, - 'blackHole' => Adapter\BlackHole::class, - 'BlackHole' => Adapter\BlackHole::class, - 'dba' => Adapter\Dba::class, - 'Dba' => Adapter\Dba::class, - 'filesystem' => Adapter\Filesystem::class, - 'Filesystem' => Adapter\Filesystem::class, - 'memcache' => Adapter\Memcache::class, - 'Memcache' => Adapter\Memcache::class, - 'memcached' => Adapter\Memcached::class, - 'Memcached' => Adapter\Memcached::class, - 'memory' => Adapter\Memory::class, - 'Memory' => Adapter\Memory::class, - 'mongodb' => Adapter\MongoDb::class, - 'mongoDb' => Adapter\MongoDb::class, - 'MongoDb' => Adapter\MongoDb::class, - 'redis' => Adapter\Redis::class, - 'Redis' => Adapter\Redis::class, - 'session' => Adapter\Session::class, - 'Session' => Adapter\Session::class, - 'xcache' => Adapter\XCache::class, - 'xCache' => Adapter\XCache::class, - 'XCache' => Adapter\XCache::class, - 'wincache' => Adapter\WinCache::class, - 'winCache' => Adapter\WinCache::class, - 'WinCache' => Adapter\WinCache::class, - 'zendserverdisk' => Adapter\ZendServerDisk::class, - 'zendServerDisk' => Adapter\ZendServerDisk::class, - 'ZendServerDisk' => Adapter\ZendServerDisk::class, - 'zendservershm' => Adapter\ZendServerShm::class, - 'zendServerShm' => Adapter\ZendServerShm::class, - 'ZendServerShm' => Adapter\ZendServerShm::class, + 'apc' => Adapter\Apc::class, + 'Apc' => Adapter\Apc::class, + 'APC' => Adapter\Apc::class, + 'apcu' => Adapter\Apcu::class, + 'ApcU' => Adapter\Apcu::class, + 'Apcu' => Adapter\Apcu::class, + 'APCu' => Adapter\Apcu::class, + 'black_hole' => Adapter\BlackHole::class, + 'blackhole' => Adapter\BlackHole::class, + 'blackHole' => Adapter\BlackHole::class, + 'BlackHole' => Adapter\BlackHole::class, + 'dba' => Adapter\Dba::class, + 'Dba' => Adapter\Dba::class, + 'DBA' => Adapter\Dba::class, + 'filesystem' => Adapter\Filesystem::class, + 'Filesystem' => Adapter\Filesystem::class, + 'memcache' => Adapter\Memcache::class, + 'Memcache' => Adapter\Memcache::class, + 'memcached' => Adapter\Memcached::class, + 'Memcached' => Adapter\Memcached::class, + 'memory' => Adapter\Memory::class, + 'Memory' => Adapter\Memory::class, + 'mongo_db' => Adapter\MongoDb::class, + 'mongodb' => Adapter\MongoDb::class, + 'MongoDb' => Adapter\MongoDb::class, + 'MongoDB' => Adapter\MongoDb::class, + 'mongoDb' => Adapter\MongoDb::class, + 'mongoDB' => Adapter\MongoDb::class, + 'redis' => Adapter\Redis::class, + 'Redis' => Adapter\Redis::class, + 'session' => Adapter\Session::class, + 'Session' => Adapter\Session::class, + 'xcache' => Adapter\XCache::class, + 'xCache' => Adapter\XCache::class, + 'XCache' => Adapter\XCache::class, + 'win_cache' => Adapter\WinCache::class, + 'wincache' => Adapter\WinCache::class, + 'winCache' => Adapter\WinCache::class, + 'WinCache' => Adapter\WinCache::class, + 'zend_server_disk' => Adapter\ZendServerDisk::class, + 'zendserverdisk' => Adapter\ZendServerDisk::class, + 'zendServerDisk' => Adapter\ZendServerDisk::class, + 'ZendServerDisk' => Adapter\ZendServerDisk::class, + 'zend_server_shm' => Adapter\ZendServerShm::class, + 'zendservershm' => Adapter\ZendServerShm::class, + 'zendServerShm' => Adapter\ZendServerShm::class, + 'zendServerSHM' => Adapter\ZendServerShm::class, + 'ZendServerShm' => Adapter\ZendServerShm::class, + 'ZendServerSHM' => Adapter\ZendServerShm::class, ]; protected $factories = [ diff --git a/src/Storage/PluginManager.php b/src/Storage/PluginManager.php index b22533d0f..15c4bed6c 100644 --- a/src/Storage/PluginManager.php +++ b/src/Storage/PluginManager.php @@ -24,20 +24,24 @@ class PluginManager extends AbstractPluginManager { protected $aliases = [ - 'clearexpiredbyfactor' => Plugin\ClearExpiredByFactor::class, - 'clearExpiredByFactor' => Plugin\ClearExpiredByFactor::class, - 'ClearExpiredByFactor' => Plugin\ClearExpiredByFactor::class, - 'exceptionhandler' => Plugin\ExceptionHandler::class, - 'exceptionHandler' => Plugin\ExceptionHandler::class, - 'ExceptionHandler' => Plugin\ExceptionHandler::class, - 'ignoreuserabort' => Plugin\IgnoreUserAbort::class, - 'ignoreUserAbort' => Plugin\IgnoreUserAbort::class, - 'IgnoreUserAbort' => Plugin\IgnoreUserAbort::class, - 'optimizebyfactor' => Plugin\OptimizeByFactor::class, - 'optimizeByFactor' => Plugin\OptimizeByFactor::class, - 'OptimizeByFactor' => Plugin\OptimizeByFactor::class, - 'serializer' => Plugin\Serializer::class, - 'Serializer' => Plugin\Serializer::class + 'clear_expired_by_factor' => Plugin\ClearExpiredByFactor::class, + 'clearexpiredbyfactor' => Plugin\ClearExpiredByFactor::class, + 'clearExpiredByFactor' => Plugin\ClearExpiredByFactor::class, + 'ClearExpiredByFactor' => Plugin\ClearExpiredByFactor::class, + 'exception_handler' => Plugin\ExceptionHandler::class, + 'exceptionhandler' => Plugin\ExceptionHandler::class, + 'exceptionHandler' => Plugin\ExceptionHandler::class, + 'ExceptionHandler' => Plugin\ExceptionHandler::class, + 'ignore_user_abort' => Plugin\IgnoreUserAbort::class, + 'ignoreuserabort' => Plugin\IgnoreUserAbort::class, + 'ignoreUserAbort' => Plugin\IgnoreUserAbort::class, + 'IgnoreUserAbort' => Plugin\IgnoreUserAbort::class, + 'optimize_by_factor' => Plugin\OptimizeByFactor::class, + 'optimizebyfactor' => Plugin\OptimizeByFactor::class, + 'optimizeByFactor' => Plugin\OptimizeByFactor::class, + 'OptimizeByFactor' => Plugin\OptimizeByFactor::class, + 'serializer' => Plugin\Serializer::class, + 'Serializer' => Plugin\Serializer::class ]; protected $factories = [ diff --git a/test/Pattern/CallbackCacheTest.php b/test/Pattern/CallbackCacheTest.php index 456ff75b7..e70f4850d 100644 --- a/test/Pattern/CallbackCacheTest.php +++ b/test/Pattern/CallbackCacheTest.php @@ -82,6 +82,14 @@ public function tearDown() parent::tearDown(); } + public function getCommonPatternNamesProvider() + { + return [ + ['callback'], + ['Callback'], + ]; + } + public function testCallEnabledCacheOutputByDefault() { $this->_testCall( diff --git a/test/Pattern/CaptureCacheTest.php b/test/Pattern/CaptureCacheTest.php index 35879356e..ed42ebec2 100644 --- a/test/Pattern/CaptureCacheTest.php +++ b/test/Pattern/CaptureCacheTest.php @@ -82,6 +82,14 @@ protected function _removeRecursive($dir) } } + public function getCommonPatternNamesProvider() + { + return [ + ['capture'], + ['Capture'], + ]; + } + public function testSetThrowsLogicExceptionOnMissingPublicDir() { $captureCache = new Cache\Pattern\CaptureCache(); diff --git a/test/Pattern/ClassCacheTest.php b/test/Pattern/ClassCacheTest.php index 33891cb0c..584ebf1cf 100644 --- a/test/Pattern/ClassCacheTest.php +++ b/test/Pattern/ClassCacheTest.php @@ -66,6 +66,14 @@ public function tearDown() parent::tearDown(); } + public function getCommonPatternNamesProvider() + { + return [ + ['class'], + ['Class'], + ]; + } + public function testCallEnabledCacheOutputByDefault() { $this->_testCall( diff --git a/test/Pattern/CommonPatternTest.php b/test/Pattern/CommonPatternTest.php index 7cf068d4b..2660df25b 100644 --- a/test/Pattern/CommonPatternTest.php +++ b/test/Pattern/CommonPatternTest.php @@ -9,6 +9,9 @@ namespace ZendTest\Cache\Pattern; +use Zend\ServiceManager\ServiceManager; +use Zend\Cache\PatternPluginManager; + /** * @group Zend_Cache * @covers Zend\Cache\Pattern\PatternOptions @@ -34,6 +37,23 @@ public function tearDown() unset($this->_pattern); } + /** + * A data provider for common pattern names + */ + abstract public function getCommonPatternNamesProvider(); + + /** + * @dataProvider getCommonPatternNamesProvider + */ + public function testPatternPluginManagerWithCommonNames($commonPatternName) + { + $pluginManager = new PatternPluginManager(new ServiceManager); + $this->assertTrue( + $pluginManager->has($commonPatternName), + "Pattern name '{$commonPatternName}' not found in PatternPluginManager" + ); + } + public function testOptionNamesValid() { $options = $this->_pattern->getOptions(); diff --git a/test/Pattern/ObjectCacheTest.php b/test/Pattern/ObjectCacheTest.php index 7845b86c4..01d94b464 100644 --- a/test/Pattern/ObjectCacheTest.php +++ b/test/Pattern/ObjectCacheTest.php @@ -74,6 +74,14 @@ public function tearDown() parent::tearDown(); } + public function getCommonPatternNamesProvider() + { + return [ + ['object'], + ['Object'], + ]; + } + public function testCallEnabledCacheOutputByDefault() { $this->_testCall( diff --git a/test/Pattern/OutputCacheTest.php b/test/Pattern/OutputCacheTest.php index 048bc0efc..d1de87362 100644 --- a/test/Pattern/OutputCacheTest.php +++ b/test/Pattern/OutputCacheTest.php @@ -63,6 +63,14 @@ public function tearDown() parent::tearDown(); } + public function getCommonPatternNamesProvider() + { + return [ + ['output'], + ['Output'], + ]; + } + public function testStartEndCacheMiss() { $output = 'foobar'; diff --git a/test/Storage/Adapter/AbstractDbaTest.php b/test/Storage/Adapter/AbstractDbaTest.php index 0c111305e..a07ef03c6 100644 --- a/test/Storage/Adapter/AbstractDbaTest.php +++ b/test/Storage/Adapter/AbstractDbaTest.php @@ -62,4 +62,13 @@ public function tearDown() parent::tearDown(); } + + public function getCommonAdapterNamesProvider() + { + return [ + ['dba'], + ['Dba'], + ['DBA'], + ]; + } } diff --git a/test/Storage/Adapter/ApcTest.php b/test/Storage/Adapter/ApcTest.php index c9426b53f..9d880150e 100644 --- a/test/Storage/Adapter/ApcTest.php +++ b/test/Storage/Adapter/ApcTest.php @@ -58,4 +58,12 @@ public function tearDown() parent::tearDown(); } + + public function getCommonAdapterNamesProvider() + { + return [ + ['apc'], + ['Apc'], + ]; + } } diff --git a/test/Storage/Adapter/ApcuTest.php b/test/Storage/Adapter/ApcuTest.php index e37c3a0ae..79b2236a4 100644 --- a/test/Storage/Adapter/ApcuTest.php +++ b/test/Storage/Adapter/ApcuTest.php @@ -68,4 +68,14 @@ public function tearDown() parent::tearDown(); } + + public function getCommonAdapterNamesProvider() + { + return [ + ['apcu'], + ['Apcu'], + ['ApcU'], + ['APCu'], + ]; + } } diff --git a/test/Storage/Adapter/BlackHoleTest.php b/test/Storage/Adapter/BlackHoleTest.php index d1ea6c08d..b802e8fe2 100644 --- a/test/Storage/Adapter/BlackHoleTest.php +++ b/test/Storage/Adapter/BlackHoleTest.php @@ -10,8 +10,10 @@ namespace ZendTest\Cache\Storage\Adapter; +use Zend\Cache\Storage\AdapterPluginManager; use Zend\Cache\Storage\Adapter\BlackHole; use Zend\Cache\StorageFactory; +use Zend\ServiceManager\ServiceManager; /** * PHPUnit test case @@ -38,6 +40,31 @@ public function setUp() $this->storage = StorageFactory::adapterFactory('BlackHole'); } + /** + * A data provider for common storage adapter names + */ + public function getCommonAdapterNamesProvider() + { + return [ + ['black_hole'], + ['blackhole'], + ['blackHole'], + ['BlackHole'], + ]; + } + + /** + * @dataProvider getCommonAdapterNamesProvider + */ + public function testAdapterPluginManagerWithCommonNames($commonAdapterName) + { + $pluginManager = new AdapterPluginManager(new ServiceManager); + $this->assertTrue( + $pluginManager->has($commonAdapterName), + "Storage adapter name '{$commonAdapterName}' not found in storage adapter plugin manager" + ); + } + public function testGetOptions() { $options = $this->storage->getOptions(); diff --git a/test/Storage/Adapter/CommonAdapterTest.php b/test/Storage/Adapter/CommonAdapterTest.php index 3da212e4f..496f72ec6 100644 --- a/test/Storage/Adapter/CommonAdapterTest.php +++ b/test/Storage/Adapter/CommonAdapterTest.php @@ -9,6 +9,7 @@ namespace ZendTest\Cache\Storage\Adapter; +use Zend\Cache\Storage\AdapterPluginManager; use Zend\Cache\Storage\AvailableSpaceCapableInterface; use Zend\Cache\Storage\IterableInterface; use Zend\Cache\Storage\IteratorInterface; @@ -20,6 +21,7 @@ use Zend\Cache\Storage\OptimizableInterface; use Zend\Cache\Storage\TaggableInterface; use Zend\Cache\Storage\TotalSpaceCapableInterface; +use Zend\ServiceManager\ServiceManager; use Zend\Stdlib\ErrorHandler; /** @@ -76,6 +78,23 @@ public function tearDown() } } + /** + * A data provider for common storage adapter names + */ + abstract public function getCommonAdapterNamesProvider(); + + /** + * @dataProvider getCommonAdapterNamesProvider + */ + public function testAdapterPluginManagerWithCommonNames($commonAdapterName) + { + $pluginManager = new AdapterPluginManager(new ServiceManager); + $this->assertTrue( + $pluginManager->has($commonAdapterName), + "Storage adapter name '{$commonAdapterName}' not found in storage adapter plugin manager" + ); + } + public function testOptionNamesValid() { $options = $this->_storage->getOptions()->toArray(); diff --git a/test/Storage/Adapter/FilesystemTest.php b/test/Storage/Adapter/FilesystemTest.php index b9a4cfc29..ef0b42dfb 100644 --- a/test/Storage/Adapter/FilesystemTest.php +++ b/test/Storage/Adapter/FilesystemTest.php @@ -86,6 +86,14 @@ protected function _removeRecursive($dir) } } + public function getCommonAdapterNamesProvider() + { + return [ + ['filesystem'], + ['Filesystem'], + ]; + } + public function testNormalizeCacheDir() { $cacheDir = $cacheDirExpected = realpath(sys_get_temp_dir()); diff --git a/test/Storage/Adapter/MemcacheTest.php b/test/Storage/Adapter/MemcacheTest.php index f6a10aa50..e487040e4 100644 --- a/test/Storage/Adapter/MemcacheTest.php +++ b/test/Storage/Adapter/MemcacheTest.php @@ -53,6 +53,14 @@ public function setUp() parent::setUp(); } + public function getCommonAdapterNamesProvider() + { + return [ + ['memcache'], + ['Memcache'], + ]; + } + /** * Data provider to test valid server info * diff --git a/test/Storage/Adapter/MemcachedTest.php b/test/Storage/Adapter/MemcachedTest.php index 6333726c5..ea1e0e2c4 100644 --- a/test/Storage/Adapter/MemcachedTest.php +++ b/test/Storage/Adapter/MemcachedTest.php @@ -48,6 +48,14 @@ public function setUp() parent::setUp(); } + public function getCommonAdapterNamesProvider() + { + return [ + ['memcached'], + ['Memcached'], + ]; + } + /** * @deprecated */ diff --git a/test/Storage/Adapter/MemoryTest.php b/test/Storage/Adapter/MemoryTest.php index 138f1ba40..691eae9de 100644 --- a/test/Storage/Adapter/MemoryTest.php +++ b/test/Storage/Adapter/MemoryTest.php @@ -27,6 +27,14 @@ public function setUp() parent::setUp(); } + public function getCommonAdapterNamesProvider() + { + return [ + ['memory'], + ['Memory'], + ]; + } + public function testThrowOutOfSpaceException() { $this->_options->setMemoryLimit(memory_get_usage(true) - 8); diff --git a/test/Storage/Adapter/MongoDbTest.php b/test/Storage/Adapter/MongoDbTest.php index ba32129c1..acde6d2b5 100644 --- a/test/Storage/Adapter/MongoDbTest.php +++ b/test/Storage/Adapter/MongoDbTest.php @@ -51,6 +51,16 @@ public function tearDown() parent::tearDown(); } + public function getCommonAdapterNamesProvider() + { + return [ + ['mongo_db'], + ['mongodb'], + ['MongoDb'], + ['MongoDB'], + ]; + } + public function testSetOptionsNotMongoDbOptions() { $this->_storage->setOptions([ diff --git a/test/Storage/Adapter/RedisTest.php b/test/Storage/Adapter/RedisTest.php index 099252fde..28d5dffad 100644 --- a/test/Storage/Adapter/RedisTest.php +++ b/test/Storage/Adapter/RedisTest.php @@ -70,7 +70,13 @@ public function tearDown() parent::tearDown(); } - /* Redis */ + public function getCommonAdapterNamesProvider() + { + return [ + ['redis'], + ['Redis'], + ]; + } public function testRedisSerializer() { diff --git a/test/Storage/Adapter/SessionTest.php b/test/Storage/Adapter/SessionTest.php index 0613dcdbd..349d17e2f 100644 --- a/test/Storage/Adapter/SessionTest.php +++ b/test/Storage/Adapter/SessionTest.php @@ -42,4 +42,12 @@ public function tearDown() $_SESSION = []; SessionContainer::setDefaultManager(null); } + + public function getCommonAdapterNamesProvider() + { + return [ + ['session'], + ['Session'], + ]; + } } diff --git a/test/Storage/Adapter/WinCacheTest.php b/test/Storage/Adapter/WinCacheTest.php index 0f89b6fc0..5e7d07b4c 100644 --- a/test/Storage/Adapter/WinCacheTest.php +++ b/test/Storage/Adapter/WinCacheTest.php @@ -54,4 +54,14 @@ public function tearDown() parent::tearDown(); } + + public function getCommonAdapterNamesProvider() + { + return [ + ['win_cache'], + ['wincache'], + ['WinCache'], + ['winCache'], + ]; + } } diff --git a/test/Storage/Adapter/XCacheTest.php b/test/Storage/Adapter/XCacheTest.php index 33804cce0..9d68cf9d5 100644 --- a/test/Storage/Adapter/XCacheTest.php +++ b/test/Storage/Adapter/XCacheTest.php @@ -74,4 +74,14 @@ public function tearDown() parent::tearDown(); } + + public function getCommonAdapterNamesProvider() + { + return [ + ['xcache'], + ['XCache'], + ['Xcache'], + ['xCache'], + ]; + } } diff --git a/test/Storage/Adapter/ZendServerDiskTest.php b/test/Storage/Adapter/ZendServerDiskTest.php index 1124293ee..8e3ab710d 100644 --- a/test/Storage/Adapter/ZendServerDiskTest.php +++ b/test/Storage/Adapter/ZendServerDiskTest.php @@ -46,4 +46,14 @@ public function tearDown() parent::tearDown(); } + + public function getCommonAdapterNamesProvider() + { + return [ + ['zend_server_disk'], + ['zendserverdisk'], + ['ZendServerDisk'], + ['zendServerDisk'], + ]; + } } diff --git a/test/Storage/Adapter/ZendServerShmTest.php b/test/Storage/Adapter/ZendServerShmTest.php index 7defef695..161f9e4cf 100644 --- a/test/Storage/Adapter/ZendServerShmTest.php +++ b/test/Storage/Adapter/ZendServerShmTest.php @@ -51,4 +51,16 @@ public function tearDown() parent::tearDown(); } + + public function getCommonAdapterNamesProvider() + { + return [ + ['zend_server_shm'], + ['zendservershm'], + ['ZendServerShm'], + ['ZendServerSHM'], + ['zendServerShm'], + ['zendServerSHM'], + ]; + } } diff --git a/test/Storage/Plugin/ClearExpiredByFactorTest.php b/test/Storage/Plugin/ClearExpiredByFactorTest.php index 87c52db0a..11b8bee9e 100644 --- a/test/Storage/Plugin/ClearExpiredByFactorTest.php +++ b/test/Storage/Plugin/ClearExpiredByFactorTest.php @@ -41,6 +41,16 @@ public function setUp() parent::setUp(); } + public function getCommonPluginNamesProvider() + { + return [ + ['clear_expired_by_factor'], + ['clearexpiredbyfactor'], + ['ClearExpiredByFactor'], + ['clearExpiredByFactor'], + ]; + } + public function testAddPlugin() { $this->_adapter->addPlugin($this->_plugin); diff --git a/test/Storage/Plugin/CommonPluginTest.php b/test/Storage/Plugin/CommonPluginTest.php index 1783669a5..7bcb31962 100644 --- a/test/Storage/Plugin/CommonPluginTest.php +++ b/test/Storage/Plugin/CommonPluginTest.php @@ -9,6 +9,9 @@ namespace ZendTest\Cache\Storage\Plugin; +use Zend\ServiceManager\ServiceManager; +use Zend\Cache\Storage\PluginManager; + /** * PHPUnit test case */ @@ -26,6 +29,23 @@ abstract class CommonPluginTest extends \PHPUnit_Framework_TestCase */ protected $_plugin; + /** + * A data provider for common storage plugin names + */ + abstract public function getCommonPluginNamesProvider(); + + /** + * @dataProvider getCommonPluginNamesProvider + */ + public function testPluginManagerWithCommonNames($commonPluginName) + { + $pluginManager = new PluginManager(new ServiceManager); + $this->assertTrue( + $pluginManager->has($commonPluginName), + "Storage plugin name '{$commonPluginName}' not found in storage plugin manager" + ); + } + public function testOptionObjectAvailable() { $options = $this->_plugin->getOptions(); diff --git a/test/Storage/Plugin/ExceptionHandlerTest.php b/test/Storage/Plugin/ExceptionHandlerTest.php index da89ea7f9..f6db94b7e 100644 --- a/test/Storage/Plugin/ExceptionHandlerTest.php +++ b/test/Storage/Plugin/ExceptionHandlerTest.php @@ -39,6 +39,16 @@ public function setUp() parent::setUp(); } + public function getCommonPluginNamesProvider() + { + return [ + ['exception_handler'], + ['exceptionhandler'], + ['ExceptionHandler'], + ['exceptionHandler'], + ]; + } + public function testAddPlugin() { $this->_adapter->addPlugin($this->_plugin); diff --git a/test/Storage/Plugin/IgnoreUserAbortTest.php b/test/Storage/Plugin/IgnoreUserAbortTest.php index 60c314ac0..ffc99e7f7 100644 --- a/test/Storage/Plugin/IgnoreUserAbortTest.php +++ b/test/Storage/Plugin/IgnoreUserAbortTest.php @@ -36,6 +36,16 @@ public function setUp() $this->_plugin->setOptions($this->_options); } + public function getCommonPluginNamesProvider() + { + return [ + ['ignore_user_abort'], + ['ignoreuserabort'], + ['IgnoreUserAbort'], + ['ignoreUserAbort'], + ]; + } + public function testAddPlugin() { $this->_adapter->addPlugin($this->_plugin); diff --git a/test/Storage/Plugin/OptimizeByFactorTest.php b/test/Storage/Plugin/OptimizeByFactorTest.php index 7358a6fce..0a1eb3f8f 100644 --- a/test/Storage/Plugin/OptimizeByFactorTest.php +++ b/test/Storage/Plugin/OptimizeByFactorTest.php @@ -39,6 +39,16 @@ public function setUp() $this->_plugin->setOptions($this->_options); } + public function getCommonPluginNamesProvider() + { + return [ + ['optimize_by_factor'], + ['optimizebyfactor'], + ['OptimizeByFactor'], + ['optimizeByFactor'], + ]; + } + public function testAddPlugin() { $this->_adapter->addPlugin($this->_plugin); diff --git a/test/Storage/Plugin/SerializerTest.php b/test/Storage/Plugin/SerializerTest.php index 81112ae47..1ac1bf907 100644 --- a/test/Storage/Plugin/SerializerTest.php +++ b/test/Storage/Plugin/SerializerTest.php @@ -38,6 +38,14 @@ public function setUp() $this->_plugin->setOptions($this->_options); } + public function getCommonPluginNamesProvider() + { + return [ + ['serializer'], + ['Serializer'], + ]; + } + public function testAddPlugin() { $this->_adapter->addPlugin($this->_plugin, 100);