| @@ 422-463 (lines=42) @@ | ||
| 419 | $this->assertSame($expr, $this->expressionBuilder->notLike($x, $like)); |
|
| 420 | } |
|
| 421 | ||
| 422 | public function testBetween() |
|
| 423 | { |
|
| 424 | $this->queryBuilder |
|
| 425 | ->expects($this->exactly(3)) |
|
| 426 | ->method('expr') |
|
| 427 | ->willReturnOnConsecutiveCalls( |
|
| 428 | $gteExpr = $this->createExprMock(), |
|
| 429 | $lteExpr = $this->createExprMock(), |
|
| 430 | $expr = $this->createExprMock() |
|
| 431 | ); |
|
| 432 | ||
| 433 | $gteExpr |
|
| 434 | ->expects($this->once()) |
|
| 435 | ->method('field') |
|
| 436 | ->with($this->identicalTo($value = 'property')) |
|
| 437 | ->will($this->returnSelf()); |
|
| 438 | ||
| 439 | $gteExpr |
|
| 440 | ->expects($this->once()) |
|
| 441 | ->method('gte') |
|
| 442 | ->with($this->identicalTo($x = 'from')) |
|
| 443 | ->will($this->returnSelf()); |
|
| 444 | ||
| 445 | $lteExpr |
|
| 446 | ->expects($this->once()) |
|
| 447 | ->method('field') |
|
| 448 | ->with($this->identicalTo($value)) |
|
| 449 | ->will($this->returnSelf()); |
|
| 450 | ||
| 451 | $lteExpr |
|
| 452 | ->expects($this->once()) |
|
| 453 | ->method('lte') |
|
| 454 | ->with($this->identicalTo($y = 'to')) |
|
| 455 | ->will($this->returnSelf()); |
|
| 456 | ||
| 457 | $expr |
|
| 458 | ->expects($this->exactly(2)) |
|
| 459 | ->method('addAnd') |
|
| 460 | ->withConsecutive([$gteExpr], [$lteExpr]); |
|
| 461 | ||
| 462 | $this->assertSame($expr, $this->expressionBuilder->between($value, $x, $y)); |
|
| 463 | } |
|
| 464 | ||
| 465 | public function testNotBetween() |
|
| 466 | { |
|
| @@ 465-506 (lines=42) @@ | ||
| 462 | $this->assertSame($expr, $this->expressionBuilder->between($value, $x, $y)); |
|
| 463 | } |
|
| 464 | ||
| 465 | public function testNotBetween() |
|
| 466 | { |
|
| 467 | $this->queryBuilder |
|
| 468 | ->expects($this->exactly(3)) |
|
| 469 | ->method('expr') |
|
| 470 | ->willReturnOnConsecutiveCalls( |
|
| 471 | $gteExpr = $this->createExprMock(), |
|
| 472 | $lteExpr = $this->createExprMock(), |
|
| 473 | $expr = $this->createExprMock() |
|
| 474 | ); |
|
| 475 | ||
| 476 | $gteExpr |
|
| 477 | ->expects($this->once()) |
|
| 478 | ->method('field') |
|
| 479 | ->with($this->identicalTo($value = 'property')) |
|
| 480 | ->will($this->returnSelf()); |
|
| 481 | ||
| 482 | $gteExpr |
|
| 483 | ->expects($this->once()) |
|
| 484 | ->method('lt') |
|
| 485 | ->with($this->identicalTo($x = 'from')) |
|
| 486 | ->will($this->returnSelf()); |
|
| 487 | ||
| 488 | $lteExpr |
|
| 489 | ->expects($this->once()) |
|
| 490 | ->method('field') |
|
| 491 | ->with($this->identicalTo($value)) |
|
| 492 | ->will($this->returnSelf()); |
|
| 493 | ||
| 494 | $lteExpr |
|
| 495 | ->expects($this->once()) |
|
| 496 | ->method('gt') |
|
| 497 | ->with($this->identicalTo($y = 'to')) |
|
| 498 | ->will($this->returnSelf()); |
|
| 499 | ||
| 500 | $expr |
|
| 501 | ->expects($this->exactly(2)) |
|
| 502 | ->method('addOr') |
|
| 503 | ->withConsecutive([$gteExpr], [$lteExpr]); |
|
| 504 | ||
| 505 | $this->assertSame($expr, $this->expressionBuilder->notBetween($value, $x, $y)); |
|
| 506 | } |
|
| 507 | ||
| 508 | /** |
|
| 509 | * @return mixed[] |
|