Skip to content

Commit 243757b

Browse files
committed
Fixed unit test StripMetaTest for PHP 8.1
1 parent f418e82 commit 243757b

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tests/Modifier/Applicator/StripMetaTest.phpt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use SixtyEightPublishers\ImageStorage\PathInfoInterface;
1414
use stdClass;
1515
use Tester\Assert;
1616
use Tester\TestCase;
17+
use Traversable;
1718

1819
require __DIR__ . '/../../bootstrap.php';
1920

@@ -32,8 +33,9 @@ final class StripMetaTest extends TestCase
3233
->andReturn(false);
3334

3435
$applicator = new StripMeta();
36+
$result = $applicator->apply($image, $pathInfo, $modifierValues, $config);
3537

36-
Assert::same([], iterator_to_array($applicator->apply($image, $pathInfo, $modifierValues, $config)));
38+
Assert::same([], $result instanceof Traversable ? iterator_to_array($result) : $result);
3739
}
3840

3941
public function testEmptyGeneratorShouldBeReturnedIfCoreIsNotImagick(): void
@@ -55,8 +57,9 @@ final class StripMetaTest extends TestCase
5557
->andReturn($core);
5658

5759
$applicator = new StripMeta();
60+
$result = $applicator->apply($image, $pathInfo, $modifierValues, $config);
5861

59-
Assert::same([], iterator_to_array($applicator->apply($image, $pathInfo, $modifierValues, $config)));
62+
Assert::same([], $result instanceof Traversable ? iterator_to_array($result) : $result);
6063
}
6164

6265
public function testMetadataShouldBeStrippedButIccProfileShouldBeKept(): void
@@ -91,8 +94,9 @@ final class StripMetaTest extends TestCase
9194
->with('icc', 'icc_profile_data');
9295

9396
$applicator = new StripMeta();
97+
$result = $applicator->apply($image, $pathInfo, $modifierValues, $config);
9498

95-
Assert::same([], iterator_to_array($applicator->apply($image, $pathInfo, $modifierValues, $config)));
99+
Assert::same([], $result instanceof Traversable ? iterator_to_array($result) : $result);
96100
}
97101

98102
public function testMetadataShouldBeStrippedWithoutIccProfile(): void
@@ -123,8 +127,9 @@ final class StripMetaTest extends TestCase
123127
->withNoArgs();
124128

125129
$applicator = new StripMeta();
130+
$result = $applicator->apply($image, $pathInfo, $modifierValues, $config);
126131

127-
Assert::same([], iterator_to_array($applicator->apply($image, $pathInfo, $modifierValues, $config)));
132+
Assert::same([], $result instanceof Traversable ? iterator_to_array($result) : $result);
128133
}
129134

130135
protected function tearDown(): void

0 commit comments

Comments
 (0)