| @@ 76-97 (lines=22) @@ | ||
| 73 | $region->evictAll(); |
|
| 74 | } |
|
| 75 | ||
| 76 | public function testGetMulti() |
|
| 77 | { |
|
| 78 | $key1 = new CacheKeyMock('key.1'); |
|
| 79 | $value1 = new CacheEntryMock(['id' => 1, 'name' => 'bar']); |
|
| 80 | ||
| 81 | $key2 = new CacheKeyMock('key.2'); |
|
| 82 | $value2 = new CacheEntryMock(['id' => 2, 'name' => 'bar']); |
|
| 83 | ||
| 84 | $this->assertFalse($this->region->contains($key1)); |
|
| 85 | $this->assertFalse($this->region->contains($key2)); |
|
| 86 | ||
| 87 | $this->region->put($key1, $value1); |
|
| 88 | $this->region->put($key2, $value2); |
|
| 89 | ||
| 90 | $this->assertTrue($this->region->contains($key1)); |
|
| 91 | $this->assertTrue($this->region->contains($key2)); |
|
| 92 | ||
| 93 | $actual = $this->region->getMultiple(new CollectionCacheEntry([$key1, $key2])); |
|
| 94 | ||
| 95 | $this->assertEquals($value1, $actual[0]); |
|
| 96 | $this->assertEquals($value2, $actual[1]); |
|
| 97 | } |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| @@ 20-41 (lines=22) @@ | ||
| 17 | return new DefaultMultiGetRegion('default.region.test', $this->cache); |
|
| 18 | } |
|
| 19 | ||
| 20 | public function testGetMulti() |
|
| 21 | { |
|
| 22 | $key1 = new CacheKeyMock('key.1'); |
|
| 23 | $value1 = new CacheEntryMock(['id' => 1, 'name' => 'bar']); |
|
| 24 | ||
| 25 | $key2 = new CacheKeyMock('key.2'); |
|
| 26 | $value2 = new CacheEntryMock(['id' => 2, 'name' => 'bar']); |
|
| 27 | ||
| 28 | $this->assertFalse($this->region->contains($key1)); |
|
| 29 | $this->assertFalse($this->region->contains($key2)); |
|
| 30 | ||
| 31 | $this->region->put($key1, $value1); |
|
| 32 | $this->region->put($key2, $value2); |
|
| 33 | ||
| 34 | $this->assertTrue($this->region->contains($key1)); |
|
| 35 | $this->assertTrue($this->region->contains($key2)); |
|
| 36 | ||
| 37 | $actual = $this->region->getMultiple(new CollectionCacheEntry([$key1, $key2])); |
|
| 38 | ||
| 39 | $this->assertEquals($value1, $actual[0]); |
|
| 40 | $this->assertEquals($value2, $actual[1]); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||