/** * @dataProvider validResourceProvider * @param string $resourceId * @param mixed $resource * @param string $expectedPersistentId * @param array $expectedServers * @param array $expectedLibOptions */ public function testValidResources($resourceId, $resource, $expectedPersistentId, $expectedServers, $expectedLibOptions) { // php-memcached is required to set libmemcached options if (is_array($resource) && isset($resource['lib_options']) && count($resource['lib_options']) > 0) { if (!class_exists('Memcached', false)) { $this->setExpectedException('Zend\\Cache\\Exception\\InvalidArgumentException', 'Unknown libmemcached option'); } } $this->assertSame($this->resourceManager, $this->resourceManager->setResource($resourceId, $resource)); $this->assertTrue($this->resourceManager->hasResource($resourceId)); $this->assertSame($expectedPersistentId, $this->resourceManager->getPersistentId($resourceId)); $this->assertEquals($expectedServers, $this->resourceManager->getServers($resourceId)); $this->assertEquals($expectedLibOptions, $this->resourceManager->getLibOptions($resourceId)); $this->assertSame($this->resourceManager, $this->resourceManager->removeResource($resourceId)); $this->assertFalse($this->resourceManager->hasResource($resourceId)); }