Skip to content

Commit 27327f6

Browse files
committed
Reverting changes for alterableSchemaTest.
1 parent dd9a986 commit 27327f6

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageDerivative.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ public function resolve(FileInterface $entity = NULL, $style, RefinableCacheable
9797
$access = $entity->access('view', NULL, TRUE);
9898
$metadata->addCacheableDependency($access);
9999
if ($access->isAllowed() && $image_style = ImageStyle::load($style)) {
100-
100+
// @phpstan-ignore-next-line
101101
$width = $entity->width;
102+
// @phpstan-ignore-next-line
102103
$height = $entity->height;
103104

104-
// @phpstan-ignore-next-line
105-
if (empty($width) || empty($height)) {
105+
if ($width == NULL || $height == NULL) {
106106
/** @var \Drupal\Core\Image\ImageInterface $image */
107107
$image = \Drupal::service('image.factory')->get($entity->getFileUri());
108108
if ($image->isValid()) {

tests/src/Kernel/AlterableSchemaTest.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,26 @@ public function testEmptySchemaExtensionAlteredQueryResultPropertyAdded(): void
114114
$this->assertSame([
115115
'errors' => [
116116
0 => [
117-
'message' => 'Cannot query field "empty" on type "Result".',
117+
'message' => 'Internal server error',
118118
'extensions' => [
119-
'category' => 'graphql',
119+
'category' => 'internal',
120120
],
121121
'locations' => [
122122
0 => [
123123
'line' => 1,
124124
'column' => 37,
125125
],
126126
],
127+
'path' => [
128+
'alterableQuery',
129+
// Reference to our variable in the error.
130+
'empty',
131+
],
127132
],
128133
],
134+
'data' => [
135+
'alterableQuery' => NULL,
136+
],
129137
], json_decode($result->getContent(), TRUE));
130138
}
131139

@@ -146,6 +154,7 @@ protected function mockSchema($id, $schema, array $extensions = []): void {
146154
$extensions['graphql_alterable_schema_test']->expects(static::any())
147155
->method('getBaseDefinition')
148156
->willReturn('');
157+
149158
// Different extension definition for different tests.
150159
// PHPUnit compatibility: remove once support for Drupal 10.2 is dropped.
151160
$methodName = method_exists($this, 'name') ? 'name' : 'getName';

0 commit comments

Comments
 (0)