Skip to content

Commit

Permalink
added new error messages to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peldax committed Jan 9, 2021
1 parent 50152f1 commit e8b1329
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions tests/Unit/Type/InterfaceTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ protected function getFieldDefinition() : \Graphpinator\Field\FieldSet
\Graphpinator\Container\Container::Int()->notNull(),
),
new \Graphpinator\Field\Field(
'argument',
'fieldArg',
\Graphpinator\Container\Container::Int()->notNull(),
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int(),
),
]),
),
new \Graphpinator\Field\Field(
'argumentNotNull',
'fieldArgNotNull',
\Graphpinator\Container\Container::Int()->notNull(),
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int()->notNull(),
),
]),
Expand Down Expand Up @@ -144,25 +144,25 @@ static function () : void {
},
),
new \Graphpinator\Field\ResolvableField(
'argument',
'fieldArg',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int(),
),
]),
),
new \Graphpinator\Field\ResolvableField(
'argumentNotNull',
'fieldArgNotNull',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int()->notNull(),
),
]),
Expand Down Expand Up @@ -207,25 +207,25 @@ static function () : void {
},
),
new \Graphpinator\Field\ResolvableField(
'argument',
'fieldArg',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int(),
),
]),
),
new \Graphpinator\Field\ResolvableField(
'argumentNotNull',
'fieldArgNotNull',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int()->notNull(),
),
]),
Expand Down Expand Up @@ -270,19 +270,19 @@ static function () : void {
},
),
new \Graphpinator\Field\ResolvableField(
'argument',
'fieldArg',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
),
new \Graphpinator\Field\ResolvableField(
'argumentNotNull',
'fieldArgNotNull',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int()->notNull(),
),
]),
Expand Down Expand Up @@ -327,25 +327,25 @@ static function () : void {
},
),
new \Graphpinator\Field\ResolvableField(
'argument',
'fieldArg',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int(),
),
]),
),
new \Graphpinator\Field\ResolvableField(
'argumentNotNull',
'fieldArgNotNull',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Boolean()->notNull(),
),
]),
Expand Down Expand Up @@ -390,25 +390,25 @@ static function () : void {
},
),
new \Graphpinator\Field\ResolvableField(
'argument',
'fieldArg',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int()->notNull(),
),
]),
),
new \Graphpinator\Field\ResolvableField(
'argumentNotNull',
'fieldArgNotNull',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int()->notNull(),
),
]),
Expand Down Expand Up @@ -470,25 +470,25 @@ static function () : void {
},
),
new \Graphpinator\Field\ResolvableField(
'argument',
'fieldArg',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int(),
),
]),
),
new \Graphpinator\Field\ResolvableField(
'argumentNotNull',
'fieldArgNotNull',
\Graphpinator\Container\Container::Int()->notNull(),
static function () : void {
},
new \Graphpinator\Argument\ArgumentSet([
new \Graphpinator\Argument\Argument(
'argumentName',
'argName',
\Graphpinator\Container\Container::Int()->notNull(),
),
]),
Expand Down Expand Up @@ -562,47 +562,47 @@ public function testSimple() : void
public function testMissingField() : void
{
$this->expectException(\Graphpinator\Exception\Type\InterfaceContractMissingField::class);
$this->expectExceptionMessage(\Graphpinator\Exception\Type\InterfaceContractMissingField::MESSAGE);
$this->expectExceptionMessage('Type "Abc" does not satisfy interface "Foo" - missing field "field".');

self::getTypeMissingField()->getFields();
}

public function testIncompatibleFieldType() : void
{
$this->expectException(\Graphpinator\Exception\Type\InterfaceContractFieldTypeMismatch::class);
$this->expectExceptionMessage(\Graphpinator\Exception\Type\InterfaceContractFieldTypeMismatch::MESSAGE);
$this->expectExceptionMessage('Type "Abc" does not satisfy interface "Foo" - field "fieldNotNull" does not have a compatible type.');

self::getTypeFieldTypeMismatch()->getFields();
}

public function testIncompatibleFieldTypeContravariance() : void
{
$this->expectException(\Graphpinator\Exception\Type\InterfaceContractFieldTypeMismatch::class);
$this->expectExceptionMessage(\Graphpinator\Exception\Type\InterfaceContractFieldTypeMismatch::MESSAGE);
$this->expectExceptionMessage('Type "Abc" does not satisfy interface "Foo" - field "fieldNotNull" does not have a compatible type.');

self::getTypeFieldTypeMismatchCovariance()->getFields();
}

public function testMissingArgument() : void
{
$this->expectException(\Graphpinator\Exception\Type\InterfaceContractMissingArgument::class);
$this->expectExceptionMessage(\Graphpinator\Exception\Type\InterfaceContractMissingArgument::MESSAGE);
$this->expectExceptionMessage('Type "Abc" does not satisfy interface "Foo" - argument "argName" on field "fieldArg" is missing.');

self::getTypeMissingArgument()->getFields();
}

public function testIncompatibleArgumentType() : void
{
$this->expectException(\Graphpinator\Exception\Type\InterfaceContractArgumentTypeMismatch::class);
$this->expectExceptionMessage(\Graphpinator\Exception\Type\InterfaceContractArgumentTypeMismatch::MESSAGE);
$this->expectExceptionMessage('Type "Abc" does not satisfy interface "Foo" - argument "argName" on field "fieldArgNotNull" does not have a compatible type.');

self::getTypeArgumentTypeMismatch()->getFields();
}

public function testIncompatibleArgumentTypeContravariance() : void
{
$this->expectException(\Graphpinator\Exception\Type\InterfaceContractArgumentTypeMismatch::class);
$this->expectExceptionMessage(\Graphpinator\Exception\Type\InterfaceContractArgumentTypeMismatch::MESSAGE);
$this->expectExceptionMessage('Type "Abc" does not satisfy interface "Foo" - argument "argName" on field "fieldArg" does not have a compatible type.');

self::getTypeArgumentTypeMismatchContravariance()->getFields();
}
Expand Down

0 comments on commit e8b1329

Please sign in to comment.