diff --git a/tests/Doctrine/Tests/ORM/Cache/DefaultRegionTest.php b/tests/Doctrine/Tests/ORM/Cache/DefaultRegionTest.php index 94cc99e35..914bcf191 100644 --- a/tests/Doctrine/Tests/ORM/Cache/DefaultRegionTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/DefaultRegionTest.php @@ -3,10 +3,12 @@ namespace Doctrine\Tests\ORM\Cache; use Doctrine\Common\Cache\ArrayCache; +use Doctrine\ORM\Cache\CollectionCacheEntry; use Doctrine\ORM\Cache\Region\DefaultRegion; use Doctrine\Tests\Mocks\CacheEntryMock; use Doctrine\Tests\Mocks\CacheKeyMock; + /** * @group DDC-2183 */ @@ -72,4 +74,27 @@ class DefaultRegionTest extends AbstractRegionTest $region->evictAll(); } + + public function testGetMulti() + { + $key1 = new CacheKeyMock('key.1'); + $value1 = new CacheEntryMock(array('id' => 1, 'name' => 'bar')); + + $key2 = new CacheKeyMock('key.2'); + $value2 = new CacheEntryMock(array('id' => 2, 'name' => 'bar')); + + $this->assertFalse($this->region->contains($key1)); + $this->assertFalse($this->region->contains($key2)); + + $this->region->put($key1, $value1); + $this->region->put($key2, $value2); + + $this->assertTrue($this->region->contains($key1)); + $this->assertTrue($this->region->contains($key2)); + + $actual = $this->region->getMultiple(new CollectionCacheEntry(array($key1, $key2))); + + $this->assertEquals($value1, $actual[0]); + $this->assertEquals($value2, $actual[1]); + } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Cache/MultiGetRegionTest.php b/tests/Doctrine/Tests/ORM/Cache/MultiGetRegionTest.php index 4c3258a12..091ec672a 100644 --- a/tests/Doctrine/Tests/ORM/Cache/MultiGetRegionTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/MultiGetRegionTest.php @@ -22,10 +22,10 @@ class MultiGetRegionTest extends AbstractRegionTest public function testGetMulti() { $key1 = new CacheKeyMock('key.1'); - $value1 = new CacheEntryMock(array('id'=>1, 'name' => 'bar')); + $value1 = new CacheEntryMock(array('id' => 1, 'name' => 'bar')); $key2 = new CacheKeyMock('key.2'); - $value2 = new CacheEntryMock(array('id'=>2, 'name' => 'bar')); + $value2 = new CacheEntryMock(array('id' => 2, 'name' => 'bar')); $this->assertFalse($this->region->contains($key1)); $this->assertFalse($this->region->contains($key2)); @@ -33,6 +33,9 @@ class MultiGetRegionTest extends AbstractRegionTest $this->region->put($key1, $value1); $this->region->put($key2, $value2); + $this->assertTrue($this->region->contains($key1)); + $this->assertTrue($this->region->contains($key2)); + $actual = $this->region->getMultiple(new CollectionCacheEntry(array($key1, $key2))); $this->assertEquals($value1, $actual[0]);