public function testAssertHasNotInDeleteQueue() { $mock = new MemcachedMock(); $mock->setThrowExceptionsOnFailure(true); $mock->addServer('127.0.0.1', 11211); $mock->set('a', 'b'); $mock->delete('a', 100); $mock->setThrowExceptionsOnFailure(false); $mockReflection = new \ReflectionClass($mock); $method = $mockReflection->getMethod('assertHasNotInDeleteQueue'); $method->setAccessible(true); $this->assertFalse($method->invokeArgs($mock, ['a'])); }
public function testReplace() { $testKey = 'abc000'; $testValue = 'start'; $testReplaceValue = '_end'; $mock = new MemcachedMock(); $this->assertFalse($mock->replace($testKey, $testValue)); $mock->addServer('127.0.0.1', 11211); $this->assertFalse($mock->replace(null, $testValue)); $this->assertFalse($mock->replace($testKey, '1')); $mock->set($testKey, $testValue); $this->assertTrue($mock->replace($testKey, $testReplaceValue)); $this->assertSame($testReplaceValue, $mock->get($testKey)); $this->assertFalse($mock->replace($testKey, xml_parser_create(''))); $this->assertFalse($mock->replace($testKey, $testReplaceValue, 'invalid')); $this->assertTrue($mock->replace($testKey, $testReplaceValue, 10)); $this->assertSame(time() + 10, $mock->getExpiry($testKey)); }