@@ 169-194 (lines=26) @@ | ||
166 | ]; |
|
167 | } |
|
168 | ||
169 | public function testPopulateShouldNotClearObjectManager() |
|
170 | { |
|
171 | $nbObjects = 1; |
|
172 | $objects = [1]; |
|
173 | $this->options['clear_object_manager'] = false; |
|
174 | ||
175 | $provider = $this->getMockAbstractProvider(); |
|
176 | ||
177 | $provider->expects($this->any()) |
|
178 | ->method('countObjects') |
|
179 | ->will($this->returnValue($nbObjects)); |
|
180 | ||
181 | $this->sliceFetcher->expects($this->any()) |
|
182 | ->method('fetch') |
|
183 | ->will($this->returnValue($objects)); |
|
184 | ||
185 | $this->indexable->expects($this->any()) |
|
186 | ->method('isObjectIndexable') |
|
187 | ->with('index', 'type', $this->anything()) |
|
188 | ->will($this->returnValue(true)); |
|
189 | ||
190 | $this->objectManager->expects($this->never()) |
|
191 | ->method('clear'); |
|
192 | ||
193 | $provider->populate(); |
|
194 | } |
|
195 | ||
196 | public function testPopulateShouldClearObjectManagerForFilteredBatch() |
|
197 | { |
|
@@ 196-220 (lines=25) @@ | ||
193 | $provider->populate(); |
|
194 | } |
|
195 | ||
196 | public function testPopulateShouldClearObjectManagerForFilteredBatch() |
|
197 | { |
|
198 | $nbObjects = 1; |
|
199 | $objects = [1]; |
|
200 | ||
201 | $provider = $this->getMockAbstractProvider(true); |
|
202 | ||
203 | $provider->expects($this->any()) |
|
204 | ->method('countObjects') |
|
205 | ->will($this->returnValue($nbObjects)); |
|
206 | ||
207 | $this->sliceFetcher->expects($this->any()) |
|
208 | ->method('fetch') |
|
209 | ->will($this->returnValue($objects)); |
|
210 | ||
211 | $this->indexable->expects($this->any()) |
|
212 | ->method('isObjectIndexable') |
|
213 | ->with('index', 'type', $this->anything()) |
|
214 | ->will($this->returnValue(false)); |
|
215 | ||
216 | $this->objectManager->expects($this->once()) |
|
217 | ->method('clear'); |
|
218 | ||
219 | $provider->populate(); |
|
220 | } |
|
221 | ||
222 | public function testPopulateInvokesLoggerClosure() |
|
223 | { |