Skip to content

Commit

Permalink
Update test and is_array check for optional actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mtolhuys committed Mar 6, 2020
1 parent 3a3fdf1 commit c701d24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Http/Controllers/Traits/HasOptionalActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait HasOptionalActions
*/
public function optionalActions($request)
{
if (! isset($request['actions'])) {
if (! is_array($request['actions'])) {
return;
}

Expand Down
4 changes: 3 additions & 1 deletion tests/Feature/ModelsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@ public function tearDown(): void

/** @test
* @throws ReflectionException
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function it_successfully_creates_models_with_all_optional_actions()
{
(new ModelsController())->create(new CreateModelRequest([
'name' => 'Wombat',
'fields' => $this->fields,
'actions' => [
'hasResource' => 'true',
'hasModelMigration' => 'true',
'hasResourceController' => 'true',
'hasFormRequest' => 'true',
],
]));
Expand Down

0 comments on commit c701d24

Please sign in to comment.