| @@ 371-393 (lines=23) @@ | ||
| 368 | /** |
|
| 369 | * @dataProvider likeProvider |
|
| 370 | */ |
|
| 371 | public function testLike($like, $regex) |
|
| 372 | { |
|
| 373 | $this->queryBuilder |
|
| 374 | ->expects($this->once()) |
|
| 375 | ->method('expr') |
|
| 376 | ->will($this->returnValue($expr = $this->createExprMock())); |
|
| 377 | ||
| 378 | $expr |
|
| 379 | ->expects($this->once()) |
|
| 380 | ->method('field') |
|
| 381 | ->with($this->identicalTo($x = 'property')) |
|
| 382 | ->will($this->returnSelf()); |
|
| 383 | ||
| 384 | $expr |
|
| 385 | ->expects($this->once()) |
|
| 386 | ->method('equals') |
|
| 387 | ->with($this->callback(function ($parameter) use ($regex) { |
|
| 388 | return $parameter instanceof \MongoRegex && (string) $parameter === $regex; |
|
| 389 | })) |
|
| 390 | ->will($this->returnSelf()); |
|
| 391 | ||
| 392 | $this->assertSame($expr, $this->expressionBuilder->like($x, $like)); |
|
| 393 | } |
|
| 394 | ||
| 395 | /** |
|
| 396 | * @dataProvider likeProvider |
|
| @@ 398-420 (lines=23) @@ | ||
| 395 | /** |
|
| 396 | * @dataProvider likeProvider |
|
| 397 | */ |
|
| 398 | public function testNotLike($like, $regex) |
|
| 399 | { |
|
| 400 | $this->queryBuilder |
|
| 401 | ->expects($this->once()) |
|
| 402 | ->method('expr') |
|
| 403 | ->will($this->returnValue($expr = $this->createExprMock())); |
|
| 404 | ||
| 405 | $expr |
|
| 406 | ->expects($this->once()) |
|
| 407 | ->method('field') |
|
| 408 | ->with($this->identicalTo($x = 'property')) |
|
| 409 | ->will($this->returnSelf()); |
|
| 410 | ||
| 411 | $expr |
|
| 412 | ->expects($this->once()) |
|
| 413 | ->method('not') |
|
| 414 | ->with($this->callback(function ($parameter) use ($regex) { |
|
| 415 | return $parameter instanceof \MongoRegex && (string) $parameter === $regex; |
|
| 416 | })) |
|
| 417 | ->will($this->returnSelf()); |
|
| 418 | ||
| 419 | $this->assertSame($expr, $this->expressionBuilder->notLike($x, $like)); |
|
| 420 | } |
|
| 421 | ||
| 422 | public function testBetween() |
|
| 423 | { |
|