|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | use cebe\openapi\Reader; |
| 4 | +use cebe\openapi\spec\Example; |
4 | 5 | use cebe\openapi\spec\OpenApi; |
5 | 6 | use cebe\openapi\spec\Parameter; |
6 | 7 | use cebe\openapi\spec\Reference; |
7 | 8 | use cebe\openapi\spec\RequestBody; |
8 | 9 | use cebe\openapi\spec\Response; |
9 | 10 | use cebe\openapi\spec\Schema; |
10 | | -use cebe\openapi\spec\Example; |
| 11 | +use donatj\MockWebServer\MockWebServer; |
11 | 12 |
|
12 | 13 | /** |
13 | 14 | * @covers \cebe\openapi\spec\Reference |
14 | 15 | */ |
15 | 16 | class ReferenceTest extends \PHPUnit\Framework\TestCase |
16 | 17 | { |
| 18 | + /** @var MockWebServer */ |
| 19 | + private $server; |
| 20 | + |
| 21 | + protected function setUp(): void |
| 22 | + { |
| 23 | + $this->server = new MockWebServer(); |
| 24 | + $this->server->stop(); |
| 25 | + $this->server->start(); |
| 26 | + } |
| 27 | + |
| 28 | + protected function tearDown(): void |
| 29 | + { |
| 30 | + $this->server->stop(); |
| 31 | + } |
| 32 | + |
17 | 33 | public function testResolveInDocument() |
18 | 34 | { |
19 | 35 | /** @var $openapi OpenApi */ |
@@ -233,6 +249,19 @@ public function testResolveFileInSubdirWithMultipleRelativePaths() |
233 | 249 |
|
234 | 250 | public function testResolveFileHttp() |
235 | 251 | { |
| 252 | + $url = $this->server->setResponseOfPath( |
| 253 | + '/definedPath', |
| 254 | + 'This is our http body response' |
| 255 | + ); |
| 256 | + |
| 257 | + $content = file_get_contents($url); |
| 258 | + $this->assertSame('This is our http body response', $content); |
| 259 | + |
| 260 | + |
| 261 | + // TODO |
| 262 | + return; |
| 263 | + |
| 264 | + |
236 | 265 | $file = 'https://raw.githubusercontent.com/cebe/php-openapi/290389bbd337cf4d70ecedfd3a3d886715e19552/tests/spec/data/reference/base.yaml'; |
237 | 266 | /** @var $openapi OpenApi */ |
238 | 267 | $openapi = Reader::readFromYaml(str_replace('##ABSOLUTEPATH##', dirname($file), file_get_contents($file))); |
|
0 commit comments