Skip to content

Commit

Permalink
[8.x] Fix tests (#38398)
Browse files Browse the repository at this point in the history
* Fix tests

* Apply fixes from StyleCI

Co-authored-by: Taylor Otwell <taylorotwell@users.noreply.github.com>
  • Loading branch information
driesvints and taylorotwell authored Aug 16, 2021
1 parent 59b674a commit f95f3af
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
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

0 comments on commit f95f3af

Please sign in to comment.