From b0456096b5671c36c0922b2cab601e0ae59b3ca3 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Sat, 23 Nov 2024 20:29:29 +0000 Subject: [PATCH] Fix broken test Signed-off-by: Kamil Tekiela --- .../TransformationPluginsTest.php | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/tests/unit/Plugins/Transformations/TransformationPluginsTest.php b/tests/unit/Plugins/Transformations/TransformationPluginsTest.php index a79fe9b17d..8735779359 100644 --- a/tests/unit/Plugins/Transformations/TransformationPluginsTest.php +++ b/tests/unit/Plugins/Transformations/TransformationPluginsTest.php @@ -51,7 +51,6 @@ use ReflectionMethod; use function date_default_timezone_set; use function function_exists; -use function method_exists; use const MYSQLI_TYPE_STRING; use const MYSQLI_TYPE_TINY; @@ -598,7 +597,7 @@ class TransformationPluginsTest extends AbstractTestCase [new Text_Plain_Longtoipv4(), ['168496141'], '10.11.12.13'], [new Text_Plain_Longtoipv4(), ['my ip'], 'my ip'], [new Text_Plain_Longtoipv4(), [''], '<my ip>'], - [new Text_Plain_Iptolong(), ['10.11.12.13'], 168496141], + [new Text_Plain_Iptolong(), ['10.11.12.13'], '168496141'], [new Text_Plain_Iptolong(), ['10.11.12.913'], '10.11.12.913'], [new Text_Plain_Iptolong(), ['my ip'], 'my ip'], [new Text_Plain_Iptolong(), [''], ''], @@ -647,7 +646,7 @@ class TransformationPluginsTest extends AbstractTestCase * * @param TransformationsPlugin $object instance of the plugin * @param array $applyArgs arguments for applyTransformation - * @param string|int $transformed the expected output of applyTransformation + * @param string $transformed the expected output of applyTransformation * @param bool $success the expected output of isSuccess * @param string $error the expected output of getError * @psalm-param array{string, array, FieldMetadata|null} $applyArgs @@ -656,26 +655,22 @@ class TransformationPluginsTest extends AbstractTestCase public function testTransformation( TransformationsPlugin $object, array $applyArgs, - string|int $transformed, + string $transformed, bool $success = true, string $error = '', ): void { $actual = $object->applyTransformation(...$applyArgs); self::assertEquals($transformed, $actual); - // For output transformation plugins, this method may not exist - if (method_exists($object, 'isSuccess')) { - self::assertSame( - $success, - $object->isSuccess(), - ); - } - - // For output transformation plugins, this method may not exist - if (! method_exists($object, 'getError')) { + if (! ($object instanceof IOTransformationsPlugin)) { return; } + self::assertSame( + $success, + $object->isSuccess(), + ); + self::assertSame( $error, $object->getError(),