-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ability to customize policy class per controller
- Loading branch information
Showing
34 changed files
with
305 additions
and
400 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 |
---|---|---|
|
@@ -76,15 +76,7 @@ public function updating_a_single_relation_resource_when_validation_fails(): voi | |
$post = factory(Post::class)->create(['user_id' => $user->id]); | ||
$payload = ['email' => '[email protected]']; | ||
|
||
app()->bind( | ||
ComponentsResolver::class, | ||
function () { | ||
$componentsResolverMock = Mockery::mock(\Orion\Drivers\Standard\ComponentsResolver::class)->makePartial(); | ||
$componentsResolverMock->shouldReceive('resolveRequestClass')->once()->andReturn(UserRequest::class); | ||
|
||
return $componentsResolverMock; | ||
} | ||
); | ||
$this->useRequest(UserRequest::class); | ||
|
||
Gate::policy(User::class, GreenPolicy::class); | ||
|
||
|
@@ -102,15 +94,7 @@ public function transforming_a_single_updated_relation_resource(): void | |
$post = factory(Post::class)->create(['user_id' => $user->id]); | ||
$payload = ['name' => 'test user updated']; | ||
|
||
app()->bind( | ||
ComponentsResolver::class, | ||
function () { | ||
$componentsResolverMock = Mockery::mock(\Orion\Drivers\Standard\ComponentsResolver::class)->makePartial(); | ||
$componentsResolverMock->shouldReceive('resolveResourceClass')->once()->andReturn(SampleResource::class); | ||
|
||
return $componentsResolverMock; | ||
} | ||
); | ||
$this->useResource(SampleResource::class); | ||
|
||
Gate::policy(User::class, GreenPolicy::class); | ||
|
||
|
@@ -144,4 +128,4 @@ public function updating_a_single_resource_and_getting_included_relation(): void | |
['posts' => $user->fresh('posts')->posts->toArray()] | ||
); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.