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:----Mek0m3XeWEik22g9Z9yT9LZZ/GT0yhA9vlWJnMp9V2uNxI8/Uhf/mLHXmH2VjrHHKXaxlBtwnfo2hm4sREGLL3vVLJeL5SuaF2FWeNrpX4Zqa086DWkiQYMm0xXAM0Ai+STdqKtXNYi1Fq7CcE4Ab/cOSWzev3ChJ+89OZbONlfe/oPz0hz7JHbmOJb5LMKi2+vz9BC7oZsY+sPFNaWG/eQJAI0d/dGnjp+J/GPu09Kn64i6J0K900P9T8bEYtoEqpbne5IXJ5akDHeBoazelJReozBriFv5UfgO2wtgK00a9hpJieOjuXTiegnVcAvu2gIqnEpgGSpFU1nwrULf/YF0NcCiT/zjPzAQJH5lkodnNnGmhrLUUQ/ioOWmipMxfzRgCN6eWJf8r7G4O+Aykl4BWKhqzwg27uQ5M8Hp5wCJWOCuErfDNlmH+QQVr0yc+m1WEic89iBrSZLxZshZu8iPYIKRFMA0LjU9wISBxT23sv+1BOZUSxz4pQ7+2oxx+XpEEvgprYB7dzIbb62FoH7tKcTvj8ElmWkZ6hN9oB9WsM2lRcGgNTHXPBSFV++QJUCBw3480TnJ+toPYoV6ElHs4TIZCdFHR/ZlFqMdBAWpqoFiv2klePzJeVlPbQnDkvJjkfWIqDxtWsEPx1gSHkJrO+YXyd8YoCnkgyK0cvg=----ATTACHMENT:----OTk3MTQ1MDk2MTkwODc4MyA4ODA5OTM3MzQ3NTI0NjU5IDY5NDY2MTI5ODM5NzA0MDI=