diff --git a/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php b/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php index 08b4d91e813e97fc7ec3e2d2ec79afa54af96974..771f7779dfc30f5066fffca9ad68ecd2125d83a9 100644 --- a/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php +++ b/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php @@ -302,6 +302,8 @@ public function testManipulations() { // been destroyed. $new_res = $toolkit->getResource(); if ($new_res !== $old_res) { + // @todo In https://www.drupal.org/node/3133236 convert this to + // $this->assertIsNotResource($old_res). $this->assertFalse(is_resource($old_res), new FormattableMarkup("'%operation' destroyed the original resource.", ['%operation' => $values['function']])); } @@ -428,21 +430,25 @@ public function testResourceDestruction() { // Test that an Image object going out of scope releases its GD resource. $image = $this->imageFactory->get('core/tests/fixtures/files/image-test.png'); $res = $image->getToolkit()->getResource(); - $this->assertTrue(is_resource($res), 'Successfully loaded image resource.'); + $this->assertIsResource($res); $image = NULL; + // @todo In https://www.drupal.org/node/3133236 convert this to + // $this->assertIsNotResource($res). $this->assertFalse(is_resource($res), 'Image resource was destroyed after losing scope.'); // Test that 'create_new' operation does not leave orphaned GD resources. $image = $this->imageFactory->get('core/tests/fixtures/files/image-test.png'); $old_res = $image->getToolkit()->getResource(); // Check if resource has been created successfully. - $this->assertTrue(is_resource($old_res)); + $this->assertIsResource($old_res); $image->createNew(20, 20); $new_res = $image->getToolkit()->getResource(); // Check if the original resource has been destroyed. + // @todo In https://www.drupal.org/node/3133236 convert this to + // $this->assertIsNotResource($old_res). $this->assertFalse(is_resource($old_res)); // Check if a new resource has been created successfully. - $this->assertTrue(is_resource($new_res)); + $this->assertIsResource($new_res); } /** diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php index f017aafe74ba06061ac8fe77d72c6b5247ae62da..9792a8917930510abe0f9a5930f0b826332e3154 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php @@ -315,7 +315,7 @@ public function testGetAndSet() { // Binary type. $typed_data = $this->createTypedData(['type' => 'binary'], $files[0]->getFileUri()); $this->assertInstanceOf(BinaryInterface::class, $typed_data); - $this->assertTrue(is_resource($typed_data->getValue()), 'Binary value was fetched.'); + $this->assertIsResource($typed_data->getValue()); $this->assertEqual($typed_data->validate()->count(), 0); // Try setting by URI. $typed_data->setValue($files[1]->getFileUri());