Skip to content

Commit bbd2b7e

Browse files
committed
Fix tests upload not allowed parse litteral for lib 0.13.1
1 parent 2b2a192 commit bbd2b7e

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

tests/Functional/Upload/UploadTest.php

+28-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use GraphQL\Error\InvariantViolation;
66
use Overblog\GraphQLBundle\Tests\Functional\TestCase;
7+
use Overblog\GraphQLBundle\Tests\VersionHelper;
78
use Symfony\Component\HttpFoundation\File\UploadedFile;
89

910
class UploadTest extends TestCase
@@ -109,9 +110,12 @@ public function testSerializationIsUnsupported()
109110

110111
public function testParseLiteralIsUnsupported()
111112
{
112-
$this->expectException(InvariantViolation::class);
113-
$this->expectExceptionMessage('Upload scalar literal unsupported.');
114-
$this->uploadRequest(
113+
$willThrowRawException = VersionHelper::compareWebonyxGraphQLPHPVersion('0.13.1', '<');
114+
if ($willThrowRawException) {
115+
$this->expectException(InvariantViolation::class);
116+
$this->expectExceptionMessage('Upload scalar literal unsupported.');
117+
}
118+
$result = $this->uploadRequest(
115119
[
116120
'operations' => [
117121
'query' => 'mutation { singleUpload(file: {}) }',
@@ -121,6 +125,27 @@ public function testParseLiteralIsUnsupported()
121125
],
122126
['0' => 'a.txt']
123127
);
128+
if (!$willThrowRawException) {
129+
$this->assertEquals(
130+
[
131+
'errors' => [
132+
[
133+
'message' => 'Field "singleUpload" argument "file" requires type Upload, found {}; GraphQLUpload scalar literal unsupported.',
134+
'extensions' => [
135+
'category' => 'graphql',
136+
],
137+
'locations' => [
138+
[
139+
'line' => 1,
140+
'column' => 31,
141+
],
142+
],
143+
],
144+
],
145+
],
146+
$result
147+
);
148+
}
124149
}
125150

126151
private function assertUpload(array $expected, array $parameters, array $files, $uri = '/', $json = true)

0 commit comments

Comments
 (0)