Skip to content

Commit

Permalink
Update testAddDataWithNotExistsMethodOnController testcase;
Browse files Browse the repository at this point in the history
Use mockDriverGetEmptyAndSaveTmpData instead of mockDriverGetTmpData method to ensure the recieved data will be saved without any modifications;
  • Loading branch information
hans-thomas committed Dec 17, 2024
1 parent 8b725cb commit f54827b
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/SwaggerServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ public function testAddDataPostRequestWithObjectParams()

public function testAddDataWithNotExistsMethodOnController()
{
$this->mockDriverGetTmpData($this->getJsonFixture('tmp_data_get_user_request'));
$this->mockDriverGetEmptyAndSaveTmpData($this->getJsonFixture('tmp_data_get_user_request_without_request_class'));

$service = app(SwaggerService::class);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"openapi": "3.1.0",
"servers": [
{
"url": "http:\/\/localhost"
}
],
"paths": {
"/users/{id}/assign-role/{role-id}": {
"get": {
"tags": [
"users"
],
"consumes": [],
"produces": [
"application/json"
],
"parameters": [
{
"in": "path",
"name": "id",
"description": "",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "path",
"name": "role-id",
"description": "",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/getUsers{id}assignRole{roleId}200ResponseObject",
"type": "object"
},
"example": {
"id": 2,
"name": "first_client",
"likes_count": 23,
"role": {
"id": 2,
"name": "client"
},
"type": "reader"
}
}
}
}
},
"security": [],
"description": ""
}
}
},
"components": {
"schemas": {
"getUsers{id}assignRole{roleId}200ResponseObject": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"likes_count": {
"type": "integer"
},
"role": {
"type": "array"
},
"type": {
"type": "string"
}
}
}
}
},
"info": {
"description": "This is automatically collected documentation",
"version": "0.0.0",
"title": "Name of Your Application",
"termsOfService": "",
"contact": {
"email": "[email protected]"
}
}
}

0 comments on commit f54827b

Please sign in to comment.