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.
This commit is contained in:
Julien Fastré 2024-06-17 15:31:33 +02:00
parent 68d21c9267
commit 6bd38f1a58
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -338,15 +338,11 @@ abstract class AbstractAggregatorTest extends KernelTestCase
.'is a string or an be converted to a string', $key) .'is a string or an be converted to a string', $key)
); );
$this->assertTrue( $head = \call_user_func($closure, '_header');
// conditions
\is_string((string) \call_user_func($closure, '_header')) self::assertIsString($head);
&& !empty(\call_user_func($closure, '_header')) self::assertNotEquals('', $head);
&& '_header' !== \call_user_func($closure, '_header'), self::assertNotEquals('_header', $head);
// message
sprintf('Test that the callable return by `getLabels` for key %s '
.'can provide an header', $key)
);
} }
} }