@@ 109-129 (lines=21) @@ | ||
106 | $this->assertEmpty($this->parameterResolver->resolveCriteria()); |
|
107 | } |
|
108 | ||
109 | public function testResolveCriteriaWithDefault() |
|
110 | { |
|
111 | $this->requestStack |
|
112 | ->expects($this->exactly(2)) |
|
113 | ->method('getMasterRequest') |
|
114 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
115 | ||
116 | $request->attributes |
|
117 | ->expects($this->once()) |
|
118 | ->method('get') |
|
119 | ->with($this->identicalTo('_lug_criteria'), $this->identicalTo([$identifier = 'id'])) |
|
120 | ->will($this->returnValue([$identifier])); |
|
121 | ||
122 | $request |
|
123 | ->expects($this->once()) |
|
124 | ->method('get') |
|
125 | ->with($this->identicalTo($identifier), $this->isNull()) |
|
126 | ->will($this->returnValue($value = 'value')); |
|
127 | ||
128 | $this->assertSame([$identifier => $value], $this->parameterResolver->resolveCriteria()); |
|
129 | } |
|
130 | ||
131 | public function testResolveCriteriaWithExplicit() |
|
132 | { |
|
@@ 131-151 (lines=21) @@ | ||
128 | $this->assertSame([$identifier => $value], $this->parameterResolver->resolveCriteria()); |
|
129 | } |
|
130 | ||
131 | public function testResolveCriteriaWithExplicit() |
|
132 | { |
|
133 | $this->requestStack |
|
134 | ->expects($this->exactly(2)) |
|
135 | ->method('getMasterRequest') |
|
136 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
137 | ||
138 | $request->attributes |
|
139 | ->expects($this->once()) |
|
140 | ->method('get') |
|
141 | ->with($this->identicalTo('_lug_criteria'), $this->identicalTo(['id'])) |
|
142 | ->will($this->returnValue([$identifier = 'code'])); |
|
143 | ||
144 | $request |
|
145 | ->expects($this->once()) |
|
146 | ->method('get') |
|
147 | ->with($this->identicalTo($identifier), $this->isNull()) |
|
148 | ->will($this->returnValue($value = 'value')); |
|
149 | ||
150 | $this->assertSame([$identifier => $value], $this->parameterResolver->resolveCriteria()); |
|
151 | } |
|
152 | ||
153 | /** |
|
154 | * @expectedException \Lug\Bundle\ResourceBundle\Exception\RequestNotFoundException |