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