diff --git a/src/Storage/Adapter/AbstractAdapter.php b/src/Storage/Adapter/AbstractAdapter.php index e54841843..90978eff7 100644 --- a/src/Storage/Adapter/AbstractAdapter.php +++ b/src/Storage/Adapter/AbstractAdapter.php @@ -18,13 +18,14 @@ use Zend\Cache\Storage\Event; use Zend\Cache\Storage\ExceptionEvent; use Zend\Cache\Storage\Plugin; +use Zend\Cache\Storage\PluginAwareInterface; use Zend\Cache\Storage\PostEvent; use Zend\Cache\Storage\StorageInterface; use Zend\EventManager\EventManager; use Zend\EventManager\EventManagerInterface; use Zend\EventManager\EventsCapableInterface; -abstract class AbstractAdapter implements StorageInterface, EventsCapableInterface +abstract class AbstractAdapter implements StorageInterface, PluginAwareInterface { /** * The used EventManager if any @@ -253,10 +254,7 @@ protected function triggerException($eventName, ArrayObject $args, & $result, \E } /** - * Check if a plugin is registered - * - * @param Plugin\PluginInterface $plugin - * @return bool + * {@inheritdoc} */ public function hasPlugin(Plugin\PluginInterface $plugin) { @@ -265,12 +263,7 @@ public function hasPlugin(Plugin\PluginInterface $plugin) } /** - * Register a plugin - * - * @param Plugin\PluginInterface $plugin - * @param int $priority - * @return AbstractAdapter Provides a fluent interface - * @throws Exception\LogicException + * {@inheritdoc} */ public function addPlugin(Plugin\PluginInterface $plugin, $priority = 1) { @@ -289,11 +282,7 @@ public function addPlugin(Plugin\PluginInterface $plugin, $priority = 1) } /** - * Unregister an already registered plugin - * - * @param Plugin\PluginInterface $plugin - * @return AbstractAdapter Provides a fluent interface - * @throws Exception\LogicException + * {@inheritdoc} */ public function removePlugin(Plugin\PluginInterface $plugin) { @@ -306,9 +295,7 @@ public function removePlugin(Plugin\PluginInterface $plugin) } /** - * Return registry of plugins - * - * @return SplObjectStorage + * {@inheritdoc} */ public function getPluginRegistry() { diff --git a/src/Storage/PluginAwareInterface.php b/src/Storage/PluginAwareInterface.php new file mode 100644 index 000000000..fc77ff6d7 --- /dev/null +++ b/src/Storage/PluginAwareInterface.php @@ -0,0 +1,34 @@ +prophesize(Cache\Storage\AdapterPluginManager::class); + + $adapters->get('Foo')->willReturn(new AdapterWithStorageAndEventsCapableInterface()); + + Cache\StorageFactory::setAdapterPluginManager($adapters->reveal()); + ErrorHandler::start(E_USER_DEPRECATED); + + Cache\StorageFactory::factory(['adapter' => 'Foo', 'plugins' => ['IgnoreUserAbort']]); + + $stack = ErrorHandler::stop(); + $this->assertInstanceOf(ErrorException::class, $stack); + } }