From 6bd38f1a58b92f4b0b6d53ff75dceb542f1eb4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 17 Jun 2024 15:31:33 +0200 Subject: [PATCH] Refactor assertions in AbstractAggregatorTest The conditional checks in the AbstractAggregatorTest have been simplified. Instead of a complex inline condition with multiple checks, the test now uses straightforward assertions. This makes the code cleaner and easier to understand. --- .../Test/Export/AbstractAggregatorTest.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php index e66096c63..0a2faa3a2 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php @@ -338,15 +338,11 @@ abstract class AbstractAggregatorTest extends KernelTestCase .'is a string or an be converted to a string', $key) ); - $this->assertTrue( - // conditions - \is_string((string) \call_user_func($closure, '_header')) - && !empty(\call_user_func($closure, '_header')) - && '_header' !== \call_user_func($closure, '_header'), - // message - sprintf('Test that the callable return by `getLabels` for key %s ' - .'can provide an header', $key) - ); + $head = \call_user_func($closure, '_header'); + + self::assertIsString($head); + self::assertNotEquals('', $head); + self::assertNotEquals('_header', $head); } }