Skip to content

Upgrade to Graphqlite 5 #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"require" : {
"php" : ">=7.2",
"thecodingmachine/graphqlite" : "^4.1",
"thecodingmachine/graphqlite" : "^5.0",
"symfony/validator": "^4 | ^5",
"doctrine/annotations": "^1.6"
},
Expand All @@ -27,8 +27,8 @@
"mouf/picotainer": "^1.1",
"phpstan/phpstan": "^0.12.14",
"php-coveralls/php-coveralls": "^2.1.0",
"symfony/translation": "^4",
"doctrine/coding-standard": "^7.0"
"symfony/translation": "^4 || ^5",
"doctrine/coding-standard": "^8.2 || ^9.0"
},
"scripts": {
"phpstan": "phpstan analyse src/ -c phpstan.neon --level=7 --no-progress",
Expand All @@ -48,7 +48,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "4.1.x-dev"
"dev-master": "5.0.x-dev"
}
},
"minimum-stability": "dev",
Expand Down
4 changes: 2 additions & 2 deletions tests/ConstraintValidationExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public function testException()
$this->assertSame(400, $exception->getCode());
$this->assertTrue($exception->isClientSafe());
$this->assertSame('Validate', $exception->getCategory());
$this->assertSame(['code' => 'myCode'], $exception->getExtensions());
$this->assertSame(['code' => 'myCode', 'field' => ''], $exception->getExtensions());

$exception = new ConstraintViolationException(new ConstraintViolation('foo', 'foo {bar}', ['bar' => 'baz'], null, null, 'invalidValue'));
$this->assertSame([], $exception->getExtensions());
$this->assertSame(['field' => ''], $exception->getExtensions());
}
}
12 changes: 6 additions & 6 deletions tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


use Doctrine\Common\Annotations\AnnotationReader;
use GraphQL\Error\Debug;
use GraphQL\Error\DebugFlag;
use GraphQL\GraphQL;
use GraphQL\Type\Schema;
use Mouf\Picotainer\Picotainer;
Expand Down Expand Up @@ -83,7 +83,7 @@ public function testEndToEndThrowException(): void
$result->setErrorsHandler([WebonyxErrorHandler::class, 'errorHandler']);
$result->setErrorFormatter([WebonyxErrorHandler::class, 'errorFormatter']);

$errors = $result->toArray(Debug::RETHROW_UNSAFE_EXCEPTIONS)['errors'];
$errors = $result->toArray(DebugFlag::RETHROW_UNSAFE_EXCEPTIONS)['errors'];
$this->assertSame('The email \'"foofgdjkerbrtehrthjker.com"\' is not a valid email.', $errors[0]['message']);
$this->assertSame('email', $errors[0]['extensions']['field']);
$this->assertSame('Validate', $errors[0]['extensions']['category']);
Expand Down Expand Up @@ -112,7 +112,7 @@ public function testEndToEndAssert(): void
$result->setErrorsHandler([WebonyxErrorHandler::class, 'errorHandler']);
$result->setErrorFormatter([WebonyxErrorHandler::class, 'errorFormatter']);

$errors = $result->toArray(Debug::RETHROW_UNSAFE_EXCEPTIONS)['errors'];
$errors = $result->toArray(DebugFlag::RETHROW_UNSAFE_EXCEPTIONS)['errors'];

// TODO: find why message is not in French...
$this->assertSame('This value is not a valid email address.', $errors[0]['message']);
Expand All @@ -135,7 +135,7 @@ public function testEndToEndAssert(): void
$result->setErrorsHandler([WebonyxErrorHandler::class, 'errorHandler']);
$result->setErrorFormatter([WebonyxErrorHandler::class, 'errorFormatter']);

$data = $result->toArray(Debug::RETHROW_UNSAFE_EXCEPTIONS)['data'];
$data = $result->toArray(DebugFlag::RETHROW_UNSAFE_EXCEPTIONS)['data'];
$this->assertSame('[email protected]', $data['findByMail']['email']);

// Test default parameter
Expand All @@ -154,7 +154,7 @@ public function testEndToEndAssert(): void
$result->setErrorsHandler([WebonyxErrorHandler::class, 'errorHandler']);
$result->setErrorFormatter([WebonyxErrorHandler::class, 'errorFormatter']);

$data = $result->toArray(Debug::RETHROW_UNSAFE_EXCEPTIONS)['data'];
$data = $result->toArray(DebugFlag::RETHROW_UNSAFE_EXCEPTIONS)['data'];
$this->assertSame('[email protected]', $data['findByMail']['email']);

}
Expand All @@ -169,4 +169,4 @@ public function testException(): void
$this->expectExceptionMessage('In method TheCodingMachine\Graphqlite\Validator\Fixtures\InvalidControllers\InvalidController::invalid(), the @Assert annotation is targeting parameter "$resolveInfo". You cannot target this parameter because it is not part of the GraphQL Input type. You can only assert parameters coming from the end user.');
$schema->validate();
}
}
}