createMock(MemoryCache::class); $adapter1->expects($this->once())->method('set')->with("foo", "bar", 300); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->once())->method('set')->with("foo", "bar", 300); $cache = new CacheChain([$adapter1, $adapter2]); $cache->set("foo", "bar", 300); } public function testChainSetMultiple() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('setMultiple')->with(["foo" => 1, "bar" => 2], 300); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->once())->method('setMultiple')->with(["foo" => 1, "bar" => 2], 300); $cache = new CacheChain([$adapter1, $adapter2]); $cache->setMultiple(["foo" => 1, "bar" => 2], 300); } public function testChainGetFirst() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('get')->with("foo")->willReturn("bar"); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->never())->method('get'); $cache = new CacheChain([$adapter1, $adapter2]); $this->assertEquals("bar", $cache->get("foo", 42)); } public function testChainGetSecond() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('get')->with("foo")->willReturn(null); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->once())->method('get')->with("foo")->willReturn("car"); $cache = new CacheChain([$adapter1, $adapter2]); $this->assertEquals("car", $cache->get("foo", 42)); } public function testChainGetNone() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('get')->with("foo")->willReturn(null); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->once())->method('get')->with("foo")->willReturn(null); $cache = new CacheChain([$adapter1, $adapter2]); $this->assertEquals(42, $cache->get("foo", 42)); } public function testChainGetMultipleFirst() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('getMultiple')->with(["foo", "bar"]) ->willReturn(["foo" => 1, "bar" => 2]); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->never())->method('getMultiple'); $cache = new CacheChain([$adapter1, $adapter2]); $this->assertEquals(["foo" => 1, "bar" => 2], $cache->getMultiple(["foo", "bar"])); } public function testChainGetMultipleMixed() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('getMultiple') ->with($this->equalTo(["foo", "bar", "wux", "lot"])) ->willReturn(["foo" => null, "bar" => 2, "wux" => null, "lot" => null]); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->once())->method('getMultiple') ->with($this->equalTo(["foo", "wux", "lot"])) ->willReturn(["foo" => 11, "wux" => 15, "lot" => null]); $cache = new CacheChain([$adapter1, $adapter2]); $expected = ["foo" => 11, "bar" => 2, "wux" => 15, "lot" => 42]; $this->assertEquals($expected, $cache->getMultiple(["foo", "bar", "wux", "lot"], 42)); } public function testChainHasFirst() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('has')->with("foo")->willReturn(true); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->never())->method('has'); $cache = new CacheChain([$adapter1, $adapter2]); $this->assertTrue($cache->has("foo")); } public function testChainHasSecond() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('has')->with("foo")->willReturn(false); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->once())->method('has')->with("foo")->willReturn(true); $cache = new CacheChain([$adapter1, $adapter2]); $this->assertTrue($cache->has("foo")); } public function testChainHasNone() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('has')->with("foo")->willReturn(false); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->once())->method('has')->with("foo")->willReturn(false); $cache = new CacheChain([$adapter1, $adapter2]); $this->assertFalse($cache->has("foo")); } public function testChainDelete() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('delete')->with("foo"); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->once())->method('delete')->with("foo"); $cache = new CacheChain([$adapter1, $adapter2]); $cache->delete("foo"); } public function testChainDeleteMultiple() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('deleteMultiple')->with(["foo", "bar"]); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->once())->method('deleteMultiple')->with(["foo", "bar"]); $cache = new CacheChain([$adapter1, $adapter2]); $cache->deleteMultiple(["foo", "bar"]); } public function testChainClear() { $adapter1 = $this->createMock(MemoryCache::class); $adapter1->expects($this->once())->method('clear'); $adapter2 = $this->createMock(MemoryCache::class); $adapter2->expects($this->once())->method('clear'); $cache = new CacheChain([$adapter1, $adapter2]); $cache->clear(); } }__halt_compiler();----SIGNATURE:----OGUzmCvXGbT454rX9wCCO9iuHexj0LTJdL9yBBwVBe9fUtk/70FttpwAMkcTa0M1/O6LfNYf/mWqvBJMaOFogja9O9xX0TnjhmAyC30Q2wa8lad0b1o62Uvv3zelyA6nL60x7euSU+f0x14Fk62WVfm1kq0Vc1p7D98Bt62kdsMIuEi2Kt+uwCGrE9bicjVtgExE5jvgH3RDwxjMyRJN1ahJ9nSavQb/FyjhNACwylKUIXfgQwi8Ad4FbzBxiLsPsAaA27VatXzkUVzYCu0ieAGzjvFqb7YCSikX/rhZiNkvvVp5fG6ioD/GUkfv1keHL46GkWMplkP7m/fxP8lOgsCDTJLJwA40yvPOTUpgPHdvHdG60mWWWZZCqi822sAl5Xy6SBBviE+K9GW/4oi5AlpfaWW91JnzTf5eDYyR8tQ24WI3epgoOIN78TUtHetrFWtWHcDbRwTcRq+vqDo+W0BrT3A3Cr9YHDQV5WmnVdChwWB2BtP7lO1ZidtkJSEycrmrhXJtdLhpjd1fasGvoHKs9bTeXN1AoM1a3rmy4fjjvW46h6tr9I4VNFtl2EQZT63rjtAg5Is6D2+4kvh2LrBkC+ncgYHARex8Mc3lrW0Xkhs8xe2BwVEZJF4k90t+Zl1Qm6zXJmEcuU7TBRHqIAdA2Uy5KgdRJ/zfTtzunDA=----ATTACHMENT:----MTgzMTI5ODQwNTkxMjM2MiA4MjQ4OTg0NTk2NTk3NzgxIDY4MjQ0NzMyNTY1NzcyOTI=