Skip to content

Commit

Permalink
added some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peldax committed Apr 28, 2020
1 parent eda3b63 commit 49a31a8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Resolver/Value/ValidatedValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ public function jsonSerialize()

public function printValue() : string
{
return \json_encode($this->value, JSON_THROW_ON_ERROR, 512);
return \json_encode($this->value, \JSON_THROW_ON_ERROR);
}
}
4 changes: 4 additions & 0 deletions tests/Spec/DirectiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ public function testRepeatable() : void
public function invalidDataProvider() : array
{
return [
[
'query queryName { field0 { field1 @skip(if: false) @skip(if: false) { name } } }',
\Graphpinator\Exception\Normalizer\DuplicatedDirective::class,
],
[
'query queryName { field0 { field1 @include(if: false) @include(if: false) { name } } }',
\Graphpinator\Exception\Normalizer\DuplicatedDirective::class,
Expand Down
28 changes: 28 additions & 0 deletions tests/Unit/Type/Container/SimpleContainerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Graphpinator\Tests\Unit\Type\Container;

final class SimpleContainerTest extends \PHPUnit\Framework\TestCase
{
public function testSimple() : void
{
$container = new \Graphpinator\Type\Container\SimpleContainer([], []);

self::assertCount(0, $container->getTypes());
self::assertCount(0, $container->getDirectives());

foreach ([
'ID', 'Int', 'Float', 'String', 'Boolean',
'__Schema', '__Type', '__TypeKind', '__Field', '__EnumValue', '__InputValue',
'__Directive', '__DirectiveLocation'
] as $typeName) {
self::assertInstanceOf(\Graphpinator\Type\Contract\NamedDefinition::class, $container->getType($typeName));
}

foreach (['skip', 'include'] as $directiveName) {
self::assertInstanceOf(\Graphpinator\Directive\Directive::class, $container->getDirective($directiveName));
}
}
}

0 comments on commit 49a31a8

Please sign in to comment.