Skip to content

Commit

Permalink
Reverting changes for alterableSchemaTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
apathak18 committed Aug 2, 2024
1 parent dd9a986 commit 27327f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ public function resolve(FileInterface $entity = NULL, $style, RefinableCacheable
$access = $entity->access('view', NULL, TRUE);
$metadata->addCacheableDependency($access);
if ($access->isAllowed() && $image_style = ImageStyle::load($style)) {

// @phpstan-ignore-next-line
$width = $entity->width;
// @phpstan-ignore-next-line
$height = $entity->height;

// @phpstan-ignore-next-line
if (empty($width) || empty($height)) {
if ($width == NULL || $height == NULL) {
/** @var \Drupal\Core\Image\ImageInterface $image */
$image = \Drupal::service('image.factory')->get($entity->getFileUri());
if ($image->isValid()) {
Expand Down
13 changes: 11 additions & 2 deletions tests/src/Kernel/AlterableSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,26 @@ public function testEmptySchemaExtensionAlteredQueryResultPropertyAdded(): void
$this->assertSame([
'errors' => [
0 => [
'message' => 'Cannot query field "empty" on type "Result".',
'message' => 'Internal server error',
'extensions' => [
'category' => 'graphql',
'category' => 'internal',
],
'locations' => [
0 => [
'line' => 1,
'column' => 37,
],
],
'path' => [
'alterableQuery',
// Reference to our variable in the error.
'empty',
],
],
],
'data' => [
'alterableQuery' => NULL,
],
], json_decode($result->getContent(), TRUE));
}

Expand All @@ -146,6 +154,7 @@ protected function mockSchema($id, $schema, array $extensions = []): void {
$extensions['graphql_alterable_schema_test']->expects(static::any())
->method('getBaseDefinition')
->willReturn('');

// Different extension definition for different tests.
// PHPUnit compatibility: remove once support for Drupal 10.2 is dropped.
$methodName = method_exists($this, 'name') ? 'name' : 'getName';
Expand Down

0 comments on commit 27327f6

Please sign in to comment.