@@ 151-175 (lines=25) @@ | ||
148 | self::assertInstanceOf(NonStrictReadWriteCachedEntityPersister::class, $cachedPersister); |
|
149 | } |
|
150 | ||
151 | public function testBuildCachedCollectionPersisterReadOnly() |
|
152 | { |
|
153 | $em = $this->em; |
|
154 | $metadata = clone $em->getClassMetadata(State::class); |
|
155 | $association = $metadata->getProperty('cities'); |
|
156 | $persister = new OneToManyPersister($em); |
|
157 | $region = new ConcurrentRegionMock( |
|
158 | new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl()) |
|
159 | ); |
|
160 | ||
161 | $association->setCache( |
|
162 | new CacheMetadata(CacheUsage::READ_ONLY, 'doctrine_tests_models_cache_state__cities') |
|
163 | ); |
|
164 | ||
165 | $this->factory->expects($this->once()) |
|
166 | ->method('getRegion') |
|
167 | ->with($this->equalTo($association->getCache())) |
|
168 | ->will($this->returnValue($region)); |
|
169 | ||
170 | ||
171 | $cachedPersister = $this->factory->buildCachedCollectionPersister($em, $persister, $association); |
|
172 | ||
173 | self::assertInstanceOf(CachedCollectionPersister::class, $cachedPersister); |
|
174 | self::assertInstanceOf(ReadOnlyCachedCollectionPersister::class, $cachedPersister); |
|
175 | } |
|
176 | ||
177 | public function testBuildCachedCollectionPersisterReadWrite() |
|
178 | { |
|
@@ 177-200 (lines=24) @@ | ||
174 | self::assertInstanceOf(ReadOnlyCachedCollectionPersister::class, $cachedPersister); |
|
175 | } |
|
176 | ||
177 | public function testBuildCachedCollectionPersisterReadWrite() |
|
178 | { |
|
179 | $em = $this->em; |
|
180 | $metadata = clone $em->getClassMetadata(State::class); |
|
181 | $association = $metadata->getProperty('cities'); |
|
182 | $persister = new OneToManyPersister($em); |
|
183 | $region = new ConcurrentRegionMock( |
|
184 | new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl()) |
|
185 | ); |
|
186 | ||
187 | $association->setCache( |
|
188 | new CacheMetadata(CacheUsage::READ_WRITE, 'doctrine_tests_models_cache_state__cities') |
|
189 | ); |
|
190 | ||
191 | $this->factory->expects($this->once()) |
|
192 | ->method('getRegion') |
|
193 | ->with($this->equalTo($association->getCache())) |
|
194 | ->will($this->returnValue($region)); |
|
195 | ||
196 | $cachedPersister = $this->factory->buildCachedCollectionPersister($em, $persister, $association); |
|
197 | ||
198 | self::assertInstanceOf(CachedCollectionPersister::class, $cachedPersister); |
|
199 | self::assertInstanceOf(ReadWriteCachedCollectionPersister::class, $cachedPersister); |
|
200 | } |
|
201 | ||
202 | public function testBuildCachedCollectionPersisterNonStrictReadWrite() |
|
203 | { |
|
@@ 202-225 (lines=24) @@ | ||
199 | self::assertInstanceOf(ReadWriteCachedCollectionPersister::class, $cachedPersister); |
|
200 | } |
|
201 | ||
202 | public function testBuildCachedCollectionPersisterNonStrictReadWrite() |
|
203 | { |
|
204 | $em = $this->em; |
|
205 | $metadata = clone $em->getClassMetadata(State::class); |
|
206 | $association = $metadata->getProperty('cities'); |
|
207 | $persister = new OneToManyPersister($em); |
|
208 | $region = new ConcurrentRegionMock( |
|
209 | new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl()) |
|
210 | ); |
|
211 | ||
212 | $association->setCache( |
|
213 | new CacheMetadata(CacheUsage::NONSTRICT_READ_WRITE, 'doctrine_tests_models_cache_state__cities') |
|
214 | ); |
|
215 | ||
216 | $this->factory->expects($this->once()) |
|
217 | ->method('getRegion') |
|
218 | ->with($this->equalTo($association->getCache())) |
|
219 | ->will($this->returnValue($region)); |
|
220 | ||
221 | $cachedPersister = $this->factory->buildCachedCollectionPersister($em, $persister, $association); |
|
222 | ||
223 | self::assertInstanceOf(CachedCollectionPersister::class, $cachedPersister); |
|
224 | self::assertInstanceOf(NonStrictReadWriteCachedCollectionPersister::class, $cachedPersister); |
|
225 | } |
|
226 | ||
227 | public function testInheritedEntityCacheRegion() |
|
228 | { |