Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
SOHELAHMED7 committed Dec 19, 2024
1 parent f7de432 commit 1c01481
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/IssueTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use cebe\openapi\Reader;

class IssueTest extends \PHPUnit\Framework\TestCase
{
// https://github.com/cebe/php-openapi/issues/175
public function test175UnableToReferenceOtherLocalJsonFile()
{
$openapi = Reader::readFromJsonFile(__DIR__.'/data/issue/175/spec.json');
$this->assertInstanceOf(\cebe\openapi\SpecObjectInterface::class, $openapi);
}
}
20 changes: 20 additions & 0 deletions tests/data/issue/175/401.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"description": "401 response",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
]
},
"example": {
"message": "Unauthenticated."
}
}
}
}
20 changes: 20 additions & 0 deletions tests/data/issue/175/spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"openapi": "3.0.0",
"info": {
"title": "My API",
"version": "1, 2"
},
"paths": {
"/v1/users/profile": {
"get": {
"operationId": "V1GetUserProfile",
"summary": "Returns the user profile",
"responses": {
"401": {
"$ref": "./401.json"
}
}
}
}
}
}

0 comments on commit 1c01481

Please sign in to comment.