@@ 478-498 (lines=21) @@ | ||
475 | $this->assertSame(10, $this->parameterResolver->resolveMaxPerPage()); |
|
476 | } |
|
477 | ||
478 | public function testResolveMaxPerPageDefault() |
|
479 | { |
|
480 | $this->requestStack |
|
481 | ->expects($this->exactly(2)) |
|
482 | ->method('getMasterRequest') |
|
483 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
484 | ||
485 | $request->attributes |
|
486 | ->expects($this->once()) |
|
487 | ->method('get') |
|
488 | ->with($this->identicalTo('_lug_max_per_page'), $this->identicalTo($maxPerPage = 10)) |
|
489 | ->will($this->returnValue($maxPerPage)); |
|
490 | ||
491 | $request |
|
492 | ->expects($this->once()) |
|
493 | ->method('get') |
|
494 | ->with($this->identicalTo('limit'), $this->identicalTo($maxPerPage)) |
|
495 | ->will($this->returnValue($maxPerPage)); |
|
496 | ||
497 | $this->assertSame($maxPerPage, $this->parameterResolver->resolveMaxPerPage()); |
|
498 | } |
|
499 | ||
500 | public function testResolveMaxPerPageExplicit() |
|
501 | { |
|
@@ 500-520 (lines=21) @@ | ||
497 | $this->assertSame($maxPerPage, $this->parameterResolver->resolveMaxPerPage()); |
|
498 | } |
|
499 | ||
500 | public function testResolveMaxPerPageExplicit() |
|
501 | { |
|
502 | $this->requestStack |
|
503 | ->expects($this->exactly(2)) |
|
504 | ->method('getMasterRequest') |
|
505 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
506 | ||
507 | $request->attributes |
|
508 | ->expects($this->once()) |
|
509 | ->method('get') |
|
510 | ->with($this->identicalTo('_lug_max_per_page'), $this->identicalTo(10)) |
|
511 | ->will($this->returnValue($maxPerPage = 5)); |
|
512 | ||
513 | $request |
|
514 | ->expects($this->once()) |
|
515 | ->method('get') |
|
516 | ->with($this->identicalTo('limit'), $this->identicalTo($maxPerPage)) |
|
517 | ->will($this->returnValue($maxPerPage)); |
|
518 | ||
519 | $this->assertSame($maxPerPage, $this->parameterResolver->resolveMaxPerPage()); |
|
520 | } |
|
521 | ||
522 | public function testResolveMaxPerPageDynamic() |
|
523 | { |
|
@@ 544-564 (lines=21) @@ | ||
541 | $this->assertSame($maxPerPage, $this->parameterResolver->resolveMaxPerPage()); |
|
542 | } |
|
543 | ||
544 | public function testResolveMaxPerPageLowerThan0() |
|
545 | { |
|
546 | $this->requestStack |
|
547 | ->expects($this->exactly(2)) |
|
548 | ->method('getMasterRequest') |
|
549 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
550 | ||
551 | $request->attributes |
|
552 | ->expects($this->once()) |
|
553 | ->method('get') |
|
554 | ->with($this->identicalTo('_lug_max_per_page'), $this->identicalTo($default = 10)) |
|
555 | ->will($this->returnValue($default)); |
|
556 | ||
557 | $request |
|
558 | ->expects($this->once()) |
|
559 | ->method('get') |
|
560 | ->with($this->identicalTo('limit'), $this->identicalTo($default)) |
|
561 | ->will($this->returnValue(0)); |
|
562 | ||
563 | $this->assertSame($default, $this->parameterResolver->resolveMaxPerPage()); |
|
564 | } |
|
565 | ||
566 | public function testResolveMaxPerPageUpperThan100() |
|
567 | { |