Skip to content

Commit

Permalink
fix patch test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Dec 28, 2015
1 parent 4d9ff32 commit d113802
Show file tree
Hide file tree
Showing 6 changed files with 373 additions and 216 deletions.
4 changes: 2 additions & 2 deletions tests/PSX/Api/Resource/Generator/Wsdl/SoapEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testPostItem()
$message = $this->getSoapClient()->postItem($entry);

$this->assertTrue($message->success);
$this->assertEquals('You have successful create a record', $message->message);
$this->assertEquals('You have successful post a record', $message->message);
}

/**
Expand All @@ -89,7 +89,7 @@ public function testPutItem()
$message = $this->getSoapClient()->putItem($entry);

$this->assertTrue($message->success);
$this->assertEquals('You have successful update a record', $message->message);
$this->assertEquals('You have successful put a record', $message->message);
}

public function testDeleteItem()
Expand Down
2 changes: 1 addition & 1 deletion tests/PSX/Controller/SchemaApi/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function testPut()
$expect = <<<JSON
{
"success": true,
"message": "You have successful update a record"
"message": "You have successful put a record"
}
JSON;

Expand Down
18 changes: 15 additions & 3 deletions tests/PSX/Controller/Tool/DocumentationControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public function testDetail()
"definitions": {
"ref993f4bb37f524889fc963fedd6381458": {
"type": "object",
"title": "item",
"properties": {
"id": {
"type": "integer"
Expand All @@ -107,6 +106,7 @@ public function testDetail()
"type": "string"
}
},
"title": "item",
"additionalProperties": false
},
"refe80c8b9e68244cea3401d3b7aff00733": {
Expand All @@ -115,10 +115,10 @@ public function testDetail()
"properties": {
"entry": {
"type": "array",
"title": "entry",
"items": {
"$ref": "#\/definitions\/ref993f4bb37f524889fc963fedd6381458"
}
},
"title": "entry"
}
},
"additionalProperties": false
Expand Down Expand Up @@ -207,6 +207,12 @@ public function testDetail()
},
"DELETE-200-response": {
"$ref": "#\/definitions\/ref3a0bf597c698b671859e2c0ca2640825"
},
"PATCH-request": {
"$ref": "#\/definitions\/ref3368bc12f3927997f38dc1bea49554be"
},
"PATCH-200-response": {
"$ref": "#\/definitions\/ref3a0bf597c698b671859e2c0ca2640825"
}
}
},
Expand Down Expand Up @@ -239,6 +245,12 @@ public function testDetail()
"responses": {
"200": "#\/definitions\/DELETE-200-response"
}
},
"PATCH": {
"request": "#\/definitions\/PATCH-request",
"responses": {
"200": "#\/definitions\/PATCH-200-response"
}
}
}
}
Expand Down
51 changes: 51 additions & 0 deletions tests/PSX/Controller/Tool/RamlControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,57 @@ public function testIndex()
},
"additionalProperties": false
}
patch:
body:
application/json:
schema: |
{
"$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
"id": "urn:schema.phpsx.org#",
"type": "object",
"title": "item",
"properties": {
"id": {
"type": "integer"
},
"userId": {
"type": "integer"
},
"title": {
"type": "string",
"minLength": 3,
"maxLength": 16,
"pattern": "[A-z]+"
},
"date": {
"type": "string"
}
},
"required": [
"id"
],
"additionalProperties": false
}
responses:
200:
body:
application/json:
schema: |
{
"$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
"id": "urn:schema.phpsx.org#",
"type": "object",
"title": "message",
"properties": {
"success": {
"type": "boolean"
},
"message": {
"type": "string"
}
},
"additionalProperties": false
}

RAML;

Expand Down
61 changes: 57 additions & 4 deletions tests/PSX/Controller/Tool/SwaggerControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,25 @@ public function testDetail()
"responseModel": "DELETE-200-response"
}
]
},
{
"method": "PATCH",
"nickname": "patchItem",
"parameters": [
{
"paramType": "body",
"name": "body",
"required": true,
"type": "PATCH-request"
}
],
"responseMessages": [
{
"code": 200,
"message": "200 response",
"responseModel": "PATCH-200-response"
}
]
}
]
}
Expand Down Expand Up @@ -167,10 +186,10 @@ public function testDetail()
"properties": {
"entry": {
"type": "array",
"title": "entry",
"items": {
"$ref": "ref993f4bb37f524889fc963fedd6381458"
}
},
"title": "entry"
}
}
},
Expand Down Expand Up @@ -237,10 +256,10 @@ public function testDetail()
"properties": {
"entry": {
"type": "array",
"title": "entry",
"items": {
"$ref": "ref993f4bb37f524889fc963fedd6381458"
}
},
"title": "entry"
}
}
},
Expand Down Expand Up @@ -346,6 +365,40 @@ public function testDetail()
"type": "string"
}
}
},
"PATCH-request": {
"id": "PATCH-request",
"required": [
"id"
],
"properties": {
"id": {
"type": "integer"
},
"userId": {
"type": "integer"
},
"title": {
"type": "string",
"minLength": 3,
"maxLength": 16,
"pattern": "[A-z]+"
},
"date": {
"type": "string"
}
}
},
"PATCH-200-response": {
"id": "PATCH-200-response",
"properties": {
"success": {
"type": "boolean"
},
"message": {
"type": "string"
}
}
}
}
}
Expand Down
Loading

0 comments on commit d113802

Please sign in to comment.