Skip to content

Commit f95f3af

Browse files
[8.x] Fix tests (#38398)
* Fix tests * Apply fixes from StyleCI Co-authored-by: Taylor Otwell <[email protected]>
1 parent 59b674a commit f95f3af

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

tests/Database/DatabaseProcessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct()
3939
}
4040

4141
#[\ReturnTypeWillChange]
42-
public function lastInsertId(string $sequence = null)
42+
public function lastInsertId($sequence = null)
4343
{
4444
//
4545
}

tests/Integration/Foundation/DiscoverEventsTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ class_alias(ListenerInterface::class, 'Tests\Integration\Foundation\Fixtures\Eve
3232
], $events);
3333
}
3434

35+
/**
36+
* @requires PHP 8
37+
*/
3538
public function testUnionEventsCanBeDiscovered()
3639
{
37-
if (version_compare(phpversion(), '8.0.0', '<')) {
38-
$this->markTestSkipped('Test uses union types.');
39-
}
40-
4140
class_alias(UnionListener::class, 'Tests\Integration\Foundation\Fixtures\EventDiscovery\UnionListeners\UnionListener');
4241

4342
$events = DiscoverEvents::within(__DIR__.'/Fixtures/EventDiscovery/UnionListeners', getcwd());
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
use Illuminate\Tests\Support\AnotherExampleParameter;
4+
use Illuminate\Tests\Support\ExampleParameter;
5+
6+
return function (ExampleParameter | AnotherExampleParameter $a, $b) {
7+
//
8+
};

tests/Support/SupportReflectsClosuresTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ public function testItThrowsWhenNoFirstParameterType()
6464
});
6565
}
6666

67+
/**
68+
* @requires PHP 8
69+
*/
6770
public function testItWorksWithUnionTypes()
6871
{
6972
$types = ReflectsClosuresClass::reflectFirstAll(function (ExampleParameter $a, $b) {
@@ -74,9 +77,9 @@ public function testItWorksWithUnionTypes()
7477
ExampleParameter::class,
7578
], $types);
7679

77-
$types = ReflectsClosuresClass::reflectFirstAll(function (ExampleParameter | AnotherExampleParameter $a, $b) {
78-
//
79-
});
80+
$closure = require __DIR__.'/Fixtures/UnionTypesClosure.php';
81+
82+
$types = ReflectsClosuresClass::reflectFirstAll($closure);
8083

8184
$this->assertEquals([
8285
ExampleParameter::class,

0 commit comments

Comments
 (0)