diff --git a/test/unit/MemcachedTest.php b/test/unit/MemcachedTest.php index e54d50b..3ed9a0e 100644 --- a/test/unit/MemcachedTest.php +++ b/test/unit/MemcachedTest.php @@ -10,35 +10,27 @@ use Throwable; use function random_int; -/** - * @group Laminas_Cache - * @covers Laminas\Cache\Storage\Adapter\Memcached - */ -class MemcachedTest extends CommonAdapterTest +final class MemcachedTest extends AbstractCommonAdapterTest { public function setUp(): void { - if (! extension_loaded('memcached')) { - $this->markTestSkipped("Memcached extension is not loaded"); - } - - $this->_options = new Cache\Storage\Adapter\MemcachedOptions([ + $this->options = new Cache\Storage\Adapter\MemcachedOptions([ 'resource_id' => __CLASS__ ]); if (getenv('TESTS_LAMINAS_CACHE_MEMCACHED_HOST') && getenv('TESTS_LAMINAS_CACHE_MEMCACHED_PORT')) { - $this->_options->getResourceManager()->setServers(__CLASS__, [ + $this->options->getResourceManager()->setServers(__CLASS__, [ [getenv('TESTS_LAMINAS_CACHE_MEMCACHED_HOST'), getenv('TESTS_LAMINAS_CACHE_MEMCACHED_PORT')] ]); } elseif (getenv('TESTS_LAMINAS_CACHE_MEMCACHED_HOST')) { - $this->_options->getResourceManager()->setServers(__CLASS__, [ + $this->options->getResourceManager()->setServers(__CLASS__, [ [getenv('TESTS_LAMINAS_CACHE_MEMCACHED_HOST')] ]); } - $this->_storage = new Cache\Storage\Adapter\Memcached(); - $this->_storage->setOptions($this->_options); - $this->_storage->flush(); + $this->storage = new Cache\Storage\Adapter\Memcached(); + $this->storage->setOptions($this->options); + $this->storage->flush(); parent::setUp(); } @@ -243,7 +235,7 @@ public function testOptionPersistentId() public function testExceptionCodeIsPassedToRuntimeExceptionWhenExceptionIsBeingDetectedByInternalMethod(): void { - $memcached = new class($this->_options) extends Cache\Storage\Adapter\Memcached { + $memcached = new class($this->options) extends Cache\Storage\Adapter\Memcached { /** @psalm-param positive-int $code */ public function createExceptionWithCode(int $code): Throwable { @@ -313,8 +305,8 @@ public function testExceptionCodeIsPassedToRuntimeExceptionWhenAvailableSpaceReq public function tearDown(): void { - if ($this->_storage) { - $this->_storage->flush(); + if ($this->storage) { + $this->storage->flush(); } parent::tearDown();