Skip to content

Commit de0142b

Browse files
committed
travis: remove Laravel 5.6 and 5.7 from the test matrix
- 5.6: bug fixes ended on August 7th, 2018 and security fixes on February 7th, 2019 - 5.7: bug fixes ended on March 4th, 2019 and security fies on September 4th, 2019 Also: there's some weird edge case bug with 5.7 in the test \Rebing\GraphQL\Tests\Unit\SchemaHyphenInPathTest::testWithHyphen which makes it fail, see https://travis-ci.org/rebing/graphql-laravel/jobs/579289418 (this build was previously green until I restarted it recently): ``` 1) Rebing\GraphQL\Tests\Unit\SchemaHyphenInPathTest::testWithHyphen Failed asserting that exception of type "ErrorException" matches expected exception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException". Message was: "Invalid argument supplied for foreach()" at /home/travis/build/rebing/graphql-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:739 /home/travis/build/rebing/graphql-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:718 /home/travis/build/rebing/graphql-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:690 /home/travis/build/rebing/graphql-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:756 /home/travis/build/rebing/graphql-laravel/tests/Unit/SchemaHyphenInPathTest.php:29 ``` Locally everything is working fine so I don't see a reason to pursue this further.
1 parent 659ffdf commit de0142b

File tree

3 files changed

+85
-1
lines changed

3 files changed

+85
-1
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
[Next release](https://github.com/rebing/graphql-laravel/compare/2.1.0...master)
55
--------------
66
### Changed
7-
- Forward PHP engine errors to the application error handler
7+
- Forward PHP engine errors to the application error handler [\487 / mfn](https://github.com/rebing/graphql-laravel/pull/487)
88

99
2019-08-27, 2.1.0
1010
-----------------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Rebing\GraphQL\Tests\Unit\EngineErrorInResolverTests;
6+
7+
use Mockery;
8+
use Rebing\GraphQL\Tests\TestCase;
9+
use Illuminate\Contracts\Debug\ExceptionHandler;
10+
use Symfony\Component\Debug\Exception\FatalThrowableError;
11+
12+
class EngineErrorInResolverTest extends TestCase
13+
{
14+
private const ERROR_REGEX = '/QueryWithEngineErrorInCodeQuery::getResult\(\) must be of the type int, string given, called in/';
15+
16+
public function testForEngineError(): void
17+
{
18+
$result = $this->graphql('query { queryWithEngineErrorInCode }', [
19+
'expectErrors' => true,
20+
]);
21+
22+
$this->assertRegExp(static::ERROR_REGEX, $result['errors'][0]['debugMessage']);
23+
}
24+
25+
protected function resolveApplicationExceptionHandler($app)
26+
{
27+
// We expect the error in QueryWithEngineErrorInCodeQuery to trigger
28+
// reporting to the handler (as opposed to swallowing it silently).
29+
$handlerMock = Mockery::mock(ExceptionHandler::class);
30+
$handlerMock
31+
->shouldReceive('report')
32+
->with(Mockery::on(
33+
function (FatalThrowableError $error) {
34+
$this->assertRegExp(static::ERROR_REGEX, $error->getMessage());
35+
36+
return true;
37+
}
38+
))
39+
->once();
40+
41+
$app->instance(ExceptionHandler::class, $handlerMock);
42+
}
43+
44+
protected function getEnvironmentSetUp($app)
45+
{
46+
parent::getEnvironmentSetUp($app);
47+
48+
$app['config']->set('graphql.schemas.default', [
49+
'query' => [
50+
QueryWithEngineErrorInCodeQuery::class,
51+
],
52+
]);
53+
}
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Rebing\GraphQL\Tests\Unit\EngineErrorInResolverTests;
6+
7+
use GraphQL\Type\Definition\Type;
8+
use Rebing\GraphQL\Support\Mutation;
9+
10+
class QueryWithEngineErrorInCodeQuery extends Mutation
11+
{
12+
protected $attributes = [
13+
'name' => 'queryWithEngineErrorInCode',
14+
];
15+
16+
public function type(): Type
17+
{
18+
return Type::nonNull(Type::string());
19+
}
20+
21+
public function resolve($root, $args): string
22+
{
23+
// This code deliberately creates a PHP error!
24+
return $this->getResult('result');
25+
}
26+
27+
private function getResult(int $string): string
28+
{
29+
}
30+
}

0 commit comments

Comments
 (0)