@@ 90-119 (lines=30) @@ | ||
87 | /** |
|
88 | * @test |
|
89 | */ |
|
90 | public function willTellTransformerToCoerceRequest() |
|
91 | { |
|
92 | $this->eventMock |
|
93 | ->expects($this->once()) |
|
94 | ->method('isMasterRequest') |
|
95 | ->willReturn(true); |
|
96 | ||
97 | $this->documentMock |
|
98 | ->expects($this->once()) |
|
99 | ->method('getOperationObject') |
|
100 | ->willReturn(OperationObject::createFromOperationDefinition((object)[])); |
|
101 | ||
102 | $this->repositoryMock |
|
103 | ->expects($this->once()) |
|
104 | ->method('get') |
|
105 | ->with(self::DOCUMENT_PATH) |
|
106 | ->willReturn($this->documentMock); |
|
107 | ||
108 | $this->eventMock |
|
109 | ->expects($this->once()) |
|
110 | ->method('getRequest') |
|
111 | ->willReturn($this->request); |
|
112 | ||
113 | $this->transformerMock |
|
114 | ->expects($this->once()) |
|
115 | ->method('process') |
|
116 | ->with($this->request); |
|
117 | ||
118 | $this->listener->onKernelRequest($this->eventMock); |
|
119 | } |
|
120 | ||
121 | /** |
|
122 | * @test |
|
@@ 190-220 (lines=31) @@ | ||
187 | /** |
|
188 | * @test |
|
189 | */ |
|
190 | public function canGetOperationDefinitionUsingSwaggerPath() |
|
191 | { |
|
192 | $this->eventMock |
|
193 | ->expects($this->once()) |
|
194 | ->method('isMasterRequest') |
|
195 | ->willReturn(true); |
|
196 | ||
197 | $this->documentMock |
|
198 | ->expects($this->once()) |
|
199 | ->method('getOperationObject') |
|
200 | ->with(self::SWAGGER_PATH) |
|
201 | ->willReturn(OperationObject::createFromOperationDefinition((object)[])); |
|
202 | ||
203 | $this->repositoryMock |
|
204 | ->expects($this->once()) |
|
205 | ->method('get') |
|
206 | ->with(self::DOCUMENT_PATH) |
|
207 | ->willReturn($this->documentMock); |
|
208 | ||
209 | $this->eventMock |
|
210 | ->expects($this->once()) |
|
211 | ->method('getRequest') |
|
212 | ->willReturn($this->request); |
|
213 | ||
214 | $this->transformerMock |
|
215 | ->expects($this->once()) |
|
216 | ->method('process') |
|
217 | ->with($this->request); |
|
218 | ||
219 | $this->listener->onKernelRequest($this->eventMock); |
|
220 | } |
|
221 | } |
|
222 |