Skip to content

Commit 21632e2

Browse files
committed
Add test
1 parent 7bb4ca8 commit 21632e2

1 file changed

Lines changed: 22 additions & 12 deletions

File tree

tests/spec/ReferenceTest.php

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,27 @@ public function testResolveFileInSubdirWithMultipleRelativePaths()
249249

250250
public function testResolveFileHttp()
251251
{
252-
return;
252+
$this->server->setResponseOfPath(
253+
'/cebe/php-openapi/290389bbd337cf4d70ecedfd3a3d886715e19552/tests/spec/data/reference/definitions.yaml',
254+
'
255+
Pet:
256+
type: object
257+
properties:
258+
id:
259+
type: integer
260+
format: int64
261+
Dog:
262+
type: object
263+
properties:
264+
name:
265+
type: string
266+
'
267+
);
268+
253269
$this->server->setResponseOfPath(
254270
'/cebe/php-openapi/290389bbd337cf4d70ecedfd3a3d886715e19552/tests/spec/data/reference/base.yaml',
255-
'openapi: 3.0.0
271+
'
272+
openapi: 3.0.0
256273
info:
257274
title: Link Example
258275
version: 1.0.0
@@ -267,21 +284,14 @@ public function testResolveFileHttp()
267284
get:
268285
responses:
269286
200:
270-
description: return a pet'
287+
description: return a pet
288+
'
271289
);
272290

273-
// $content = file_get_contents($url);
274-
// $this->assertSame('This is our http body response', $content);
275-
276-
277-
// TODO
278-
// return;
279-
291+
// $file = 'https://raw.githubusercontent.com/cebe/php-openapi/290389bbd337cf4d70ecedfd3a3d886715e19552/tests/spec/data/reference/base.yaml';
280292

281-
// TODO
282293
$host = $this->server->getHost().':'.$this->server->getPort();
283294
$path = '/cebe/php-openapi/290389bbd337cf4d70ecedfd3a3d886715e19552/tests/spec/data/reference/base.yaml';
284-
// $file = 'https://raw.githubusercontent.com/cebe/php-openapi/290389bbd337cf4d70ecedfd3a3d886715e19552/tests/spec/data/reference/base.yaml';
285295
$file = 'http://'.$host.$path;
286296
/** @var $openapi OpenApi */
287297
$openapi = Reader::readFromYaml(str_replace('##ABSOLUTEPATH##', dirname($file), file_get_contents($file)));

0 commit comments

Comments
 (0)