@@ 482-505 (lines=24) @@ | ||
479 | $this->assertEmpty($this->parameterResolver->resolveLocationRouteParameters(new \stdClass())); |
|
480 | } |
|
481 | ||
482 | public function testResolveLocationRouteParametersExplicit() |
|
483 | { |
|
484 | $this->requestStack |
|
485 | ->expects($this->once()) |
|
486 | ->method('getMasterRequest') |
|
487 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
488 | ||
489 | $request->attributes |
|
490 | ->expects($this->once()) |
|
491 | ->method('get') |
|
492 | ->with($this->identicalTo('_lug_location_route_parameters'), $this->identicalTo([])) |
|
493 | ->will($this->returnValue([$parameter = 'id'])); |
|
494 | ||
495 | $object = new \stdClass(); |
|
496 | $object->{$parameter} = $value = 1; |
|
497 | ||
498 | $this->propertyAccessor |
|
499 | ->expects($this->once()) |
|
500 | ->method('getValue') |
|
501 | ->with($this->identicalTo($object), $this->identicalTo($parameter)) |
|
502 | ->will($this->returnValue($value)); |
|
503 | ||
504 | $this->assertSame([$parameter => $value], $this->parameterResolver->resolveLocationRouteParameters($object)); |
|
505 | } |
|
506 | ||
507 | public function testResolveMaxPerPageWithoutRequest() |
|
508 | { |
|
@@ 616-639 (lines=24) @@ | ||
613 | $this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters(new \stdClass())); |
|
614 | } |
|
615 | ||
616 | public function testResolveRedirectRouteParametersExplicit() |
|
617 | { |
|
618 | $this->requestStack |
|
619 | ->expects($this->once()) |
|
620 | ->method('getMasterRequest') |
|
621 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
622 | ||
623 | $request->attributes |
|
624 | ->expects($this->once()) |
|
625 | ->method('get') |
|
626 | ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([])) |
|
627 | ->will($this->returnValue([$parameter = 'id'])); |
|
628 | ||
629 | $object = new \stdClass(); |
|
630 | $object->{$parameter} = $value = 1; |
|
631 | ||
632 | $this->propertyAccessor |
|
633 | ->expects($this->once()) |
|
634 | ->method('getValue') |
|
635 | ->with($this->identicalTo($object), $this->identicalTo($parameter)) |
|
636 | ->will($this->returnValue($value)); |
|
637 | ||
638 | $this->assertSame([$parameter => $value], $this->parameterResolver->resolveRedirectRouteParameters($object)); |
|
639 | } |
|
640 | ||
641 | public function testResolveRedirectRouteParametersForwardParameters() |
|
642 | { |