diff --git a/src/Extracting/Strategies/Responses/UseTransformerTags.php b/src/Extracting/Strategies/Responses/UseTransformerTags.php index a9e59829..bb702c3f 100644 --- a/src/Extracting/Strategies/Responses/UseTransformerTags.php +++ b/src/Extracting/Strategies/Responses/UseTransformerTags.php @@ -105,7 +105,7 @@ private function getStatusCodeAndTransformerClass($tag): array { $content = $tag->getContent(); preg_match('/^(\d{3})?\s?([\s\S]*)$/', $content, $result); - $status = $result[1] ?: 200; + $status = (int)($result[1] ?: 200); $transformerClass = $result[2]; return [$status, $transformerClass]; diff --git a/tests/Strategies/Responses/UseApiResourceTagsTest.php b/tests/Strategies/Responses/UseApiResourceTagsTest.php index 7e92992b..1cb1a6bc 100644 --- a/tests/Strategies/Responses/UseApiResourceTagsTest.php +++ b/tests/Strategies/Responses/UseApiResourceTagsTest.php @@ -115,14 +115,14 @@ public function can_parse_apiresource_tags_with_model_factory_states() $strategy = new UseApiResourceTags($config); $tags = [ - new Tag('apiResource', '\Knuckles\Scribe\Tests\Fixtures\TestUserApiResource'), + new Tag('apiResource', '201 \Knuckles\Scribe\Tests\Fixtures\TestUserApiResource'), new Tag('apiResourceModel', '\Knuckles\Scribe\Tests\Fixtures\TestUser states=state1,random-state'), ]; $results = $strategy->getApiResourceResponse($strategy->getApiResourceTag($tags), $tags, ExtractedEndpointData::fromRoute($route)); $this->assertArraySubset([ [ - 'status' => 200, + 'status' => 201, 'content' => json_encode([ 'data' => [ 'id' => 4,