Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into refactor_routes
- Loading branch information
Showing
8 changed files
with
129 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rebing\GraphQL\Tests\Support\Objects; | ||
|
||
use Closure; | ||
use GraphQL\Type\Definition\ResolveInfo; | ||
use GraphQL\Type\Definition\Type; | ||
use Rebing\GraphQL\Support\Facades\GraphQL; | ||
use Rebing\GraphQL\Support\Query; | ||
|
||
class ExamplesAuthorizeMessageQuery extends Query | ||
{ | ||
protected $attributes = [ | ||
'name' => 'Examples authorize query', | ||
]; | ||
|
||
public function authorize($root, array $args, $ctx, ResolveInfo $resolveInfo = null, Closure $getSelectFields = null): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function getAuthorizationMessage(): string | ||
{ | ||
return 'You are not authorized to perform this action'; | ||
} | ||
|
||
public function type(): Type | ||
{ | ||
return Type::listOf(GraphQL::type('Example')); | ||
} | ||
|
||
public function args(): array | ||
{ | ||
return [ | ||
'index' => ['name' => 'index', 'type' => Type::int()], | ||
]; | ||
} | ||
|
||
public function resolve($root, $args, $context, ResolveInfo $resolveInfo, Closure $getSelectFields) | ||
{ | ||
$data = include __DIR__.'/data.php'; | ||
|
||
if (isset($args['index'])) { | ||
return [ | ||
$data[$args['index']], | ||
]; | ||
} | ||
|
||
return $data; | ||
} | ||
} |
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