-
-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API resources: Infer model name from @mixin
- Loading branch information
Showing
10 changed files
with
221 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,7 +204,7 @@ public function properly_binds_route_and_request_when_fetching_apiresource_respo | |
} | ||
|
||
/** @test */ | ||
public function can_parse_apiresource_tags_with_model_factory_states() | ||
public function can_parse_apiresourcemodel_tags_with_factory_states() | ||
{ | ||
$config = new DocumentationConfig([]); | ||
|
||
|
@@ -233,6 +233,36 @@ public function can_parse_apiresource_tags_with_model_factory_states() | |
], $results); | ||
} | ||
|
||
|
||
/** @test */ | ||
public function can_infer_model_from_mixin_tag_and_parse_apiresource_tags_with_factory_states() | ||
{ | ||
$config = new DocumentationConfig([]); | ||
|
||
$route = new Route(['POST'], "/somethingRandom", ['uses' => [TestController::class, 'dummy']]); | ||
|
||
$strategy = new UseApiResourceTags($config); | ||
$tags = [ | ||
new Tag('apiResource', '201 \Knuckles\Scribe\Tests\Fixtures\TestUserApiResource states=state1,random-state'), | ||
]; | ||
$results = $strategy->getApiResourceResponseFromTags($strategy->getApiResourceTag($tags), $tags, ExtractedEndpointData::fromRoute($route)); | ||
|
||
$this->assertArraySubset([ | ||
[ | ||
'status' => 201, | ||
'content' => json_encode([ | ||
'data' => [ | ||
'id' => 4, | ||
'name' => 'Tested Again', | ||
'email' => '[email protected]', | ||
'state1' => true, | ||
'random-state' => true, | ||
], | ||
]), | ||
], | ||
], $results); | ||
} | ||
|
||
/** @test */ | ||
public function loads_specified_relations_for_model() | ||
{ | ||
|
Oops, something went wrong.