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