@@ 220-244 (lines=25) @@ | ||
217 | return $filterCollection; |
|
218 | } |
|
219 | ||
220 | public function testSQLFilterGetSetParameter() |
|
221 | { |
|
222 | // Setup mock connection |
|
223 | $conn = $this->getMockConnection(); |
|
224 | $conn->expects($this->once()) |
|
225 | ->method('quote') |
|
226 | ->with($this->equalTo('en')) |
|
227 | ->will($this->returnValue("'en'")); |
|
228 | ||
229 | $em = $this->getMockEntityManager(); |
|
230 | $em->expects($this->once()) |
|
231 | ->method('getConnection') |
|
232 | ->will($this->returnValue($conn)); |
|
233 | ||
234 | $filterCollection = $this->addMockFilterCollection($em); |
|
235 | $filterCollection |
|
236 | ->expects($this->once()) |
|
237 | ->method('setFiltersStateDirty'); |
|
238 | ||
239 | $filter = new MyLocaleFilter($em); |
|
240 | ||
241 | $filter->setParameter('locale', 'en', DBALType::STRING); |
|
242 | ||
243 | $this->assertEquals("'en'", $filter->getParameter('locale')); |
|
244 | } |
|
245 | ||
246 | /** |
|
247 | * @group DDC-3161 |
|
@@ 268-292 (lines=25) @@ | ||
265 | $this->assertSame($conn, $reflMethod->invoke($filter)); |
|
266 | } |
|
267 | ||
268 | public function testSQLFilterSetParameterInfersType() |
|
269 | { |
|
270 | // Setup mock connection |
|
271 | $conn = $this->getMockConnection(); |
|
272 | $conn->expects($this->once()) |
|
273 | ->method('quote') |
|
274 | ->with($this->equalTo('en')) |
|
275 | ->will($this->returnValue("'en'")); |
|
276 | ||
277 | $em = $this->getMockEntityManager(); |
|
278 | $em->expects($this->once()) |
|
279 | ->method('getConnection') |
|
280 | ->will($this->returnValue($conn)); |
|
281 | ||
282 | $filterCollection = $this->addMockFilterCollection($em); |
|
283 | $filterCollection |
|
284 | ->expects($this->once()) |
|
285 | ->method('setFiltersStateDirty'); |
|
286 | ||
287 | $filter = new MyLocaleFilter($em); |
|
288 | ||
289 | $filter->setParameter('locale', 'en'); |
|
290 | ||
291 | $this->assertEquals("'en'", $filter->getParameter('locale')); |
|
292 | } |
|
293 | ||
294 | public function testSQLFilterAddConstraint() |
|
295 | { |