Skip to content

Commit

Permalink
isOutputable protected, added tests to match required mutation score
Browse files Browse the repository at this point in the history
  • Loading branch information
peldax committed Apr 19, 2020
1 parent b51b204 commit 81d15f1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/Exception/GraphpinatorBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ public function __construct(?\Graphpinator\Source\Location $location = null, ?Pa
$this->extensions = $extensions;
}

public function isOutputable() : bool
{
return false;
}

final public function jsonSerialize() : array
{
if (!$this->isOutputable()) {
Expand Down Expand Up @@ -57,4 +52,9 @@ public static function notOutputableResponse() : array
'message' => 'Server responded with unknown error.'
];
}

protected function isOutputable() : bool
{
return false;
}
}
2 changes: 1 addition & 1 deletion src/Exception/Parser/ParserError.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

abstract class ParserError extends \Graphpinator\Exception\GraphpinatorBase
{
public function isOutputable() : bool
protected function isOutputable() : bool
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Tokenizer/TokenizerError.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

abstract class TokenizerError extends \Graphpinator\Exception\GraphpinatorBase
{
public function isOutputable() : bool
protected function isOutputable() : bool
{
return true;
}
Expand Down
4 changes: 4 additions & 0 deletions tests/Spec/ErrorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public function simpleDataProvider() : array
'query queryName { field0 @invalidDirective() { field1 { name } } }',
\Infinityloop\Utils\Json::fromArray(['errors' => [['message' => 'Server responded with unknown error.']]]),
],
[
'query queryName { fieldThrow { field1 { name } } }',
\Infinityloop\Utils\Json::fromArray(['errors' => [['message' => 'Server responded with unknown error.']]]),
],
];
}

Expand Down
3 changes: 3 additions & 0 deletions tests/Spec/TestSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ protected function getFieldDefinition() : \Graphpinator\Field\ResolvableFieldSet
}),
new \Graphpinator\Field\ResolvableField('fieldAbstract', TestSchema::getUnion(), static function () {
return 1;
}),
new \Graphpinator\Field\ResolvableField('fieldThrow', TestSchema::getUnion(), static function () {
throw new \Exception('Random exception');
})
]);
}
Expand Down

0 comments on commit 81d15f1

Please sign in to comment.