Skip to content

Commit 00b62d2

Browse files
authored
Merge pull request #26 from mantiz/fix-test-for-skipping-union-types
Fix test for skipping union types
2 parents af42d10 + 269ab55 commit 00b62d2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/EventListener/ParamConverterListenerTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ function iAmAController(TokenContext $context) : void
2020
{
2121
}
2222

23+
#[PHP8] function iAmAFunctionWithAUnionTypeParameter(Session|TokenContext $context): void {}
24+
2325
class ParamConverterListenerTest extends TestCase
2426
{
2527
private $kernel;
@@ -49,12 +51,14 @@ public function it_converts_parameters() : void
4951
*/
5052
public function it_skips_union_types() : void
5153
{
54+
if (version_compare(phpversion(), '8.0') < 0) {
55+
self::markTestSkipped('Union types are only available for PHP>=8.0');
56+
}
57+
5258
$request = new Request();
5359
$request->setSession(new Session(new MockArraySessionStorage()));
5460

55-
$method = function ($context) : void {
56-
};
57-
$event = $this->createControllerEvent($method, $request);
61+
$event = $this->createControllerEvent('Gyro\Bundle\MVCBundle\Tests\EventListener\iAmAFunctionWithAUnionTypeParameter', $request);
5862

5963
$this->listener->onKernelController($event);
6064

0 commit comments

Comments
 (0)