Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Fix tests #38398

Merged
merged 2 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/Database/DatabaseProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct()
}

#[\ReturnTypeWillChange]
public function lastInsertId(string $sequence = null)
public function lastInsertId($sequence = null)
{
//
}
Expand Down
7 changes: 3 additions & 4 deletions tests/Integration/Foundation/DiscoverEventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ class_alias(ListenerInterface::class, 'Tests\Integration\Foundation\Fixtures\Eve
], $events);
}

/**
* @requires PHP 8
*/
public function testUnionEventsCanBeDiscovered()
{
if (version_compare(phpversion(), '8.0.0', '<')) {
$this->markTestSkipped('Test uses union types.');
}

class_alias(UnionListener::class, 'Tests\Integration\Foundation\Fixtures\EventDiscovery\UnionListeners\UnionListener');

$events = DiscoverEvents::within(__DIR__.'/Fixtures/EventDiscovery/UnionListeners', getcwd());
Expand Down
8 changes: 8 additions & 0 deletions tests/Support/Fixtures/UnionTypesClosure.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

use Illuminate\Tests\Support\AnotherExampleParameter;
use Illuminate\Tests\Support\ExampleParameter;

return function (ExampleParameter | AnotherExampleParameter $a, $b) {
//
};
9 changes: 6 additions & 3 deletions tests/Support/SupportReflectsClosuresTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public function testItThrowsWhenNoFirstParameterType()
});
}

/**
* @requires PHP 8
*/
public function testItWorksWithUnionTypes()
{
$types = ReflectsClosuresClass::reflectFirstAll(function (ExampleParameter $a, $b) {
Expand All @@ -74,9 +77,9 @@ public function testItWorksWithUnionTypes()
ExampleParameter::class,
], $types);

$types = ReflectsClosuresClass::reflectFirstAll(function (ExampleParameter | AnotherExampleParameter $a, $b) {
//
});
$closure = require __DIR__.'/Fixtures/UnionTypesClosure.php';

$types = ReflectsClosuresClass::reflectFirstAll($closure);

$this->assertEquals([
ExampleParameter::class,
Expand Down