/** * Tests getting a key and creating a new namespace for it. */ public function testGetKeyCreateNamespace() { /* Setup method calls. */ $method = $this->getMethodUsingReflection($this->baseProvider, 'getKey'); $this->baseProvider->expects($this->once())->method('doGet')->with('my_ns')->will($this->returnValue(new CacheResponse(false, false, false, 'Some error'))); $this->baseProvider->expects($this->once())->method('doSet')->with('my_ns', $this->matchesRegularExpression('/^[1-9][0-9]*$/'), 30)->will($this->returnValue(true)); /* Call method. */ $options = array(ProviderServiceInterface::CMD_OPT_NAMESPACE => 'my_ns', ProviderServiceInterface::CMD_OPT_NAMESPACE_EXPIRATION => 30); $this->assertRegExp('/^prefix:my_ns:[1-9][0-9]*:my_key$/', $method->invoke($this->baseProvider, 'my_key', $options)); }