Skip to content

Commit

Permalink
Merge pull request #6 from swisnl/shift-141435
Browse files Browse the repository at this point in the history
PHPUnit 10 Shift
  • Loading branch information
JaZo authored Feb 25, 2025
2 parents 47bac84 + 7204f09 commit 3950ab6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
composer.lock
vendor
build
.phpunit.result.cache
.phpunit.cache
23 changes: 21 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
<phpunit bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false">
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticProperties="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
</source>
<php>
<env name="APP_ENV" value="testing"/>
</php>
Expand Down
4 changes: 2 additions & 2 deletions tests/CommandRegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

use Illuminate\Foundation\Testing\DatabaseTransactions;

class CommandRegistrationTest extends TestCase
final class CommandRegistrationTest extends TestCase
{
use DatabaseTransactions;
const CARWASH_COMMANDS = [
'carwash:scrub'
];

public function testThatAllComandsGetRegisteredWithTheApplication()
public function testThatAllComandsGetRegisteredWithTheApplication(): void
{
$registeredCommands = collect(\Artisan::all())->keys();

Expand Down
16 changes: 8 additions & 8 deletions tests/ScrubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
use Illuminate\Foundation\Testing\DatabaseTransactions;
use PHPUnit\Framework\Assert;

class ScrubTest extends TestCase
final class ScrubTest extends TestCase
{
use DatabaseTransactions;

public function testThatDesiredUserDataGetsScrubbed()
public function testThatDesiredUserDataGetsScrubbed(): void
{
$this->addConfig();
$this->addUser([
Expand Down Expand Up @@ -36,7 +36,7 @@ public function testThatDesiredUserDataGetsScrubbed()
$this->assertNotEquals('cosmo@kramerica.com', $user2->email);
}

public function testThatFormattersCanBeAnInvokableClass()
public function testThatFormattersCanBeAnInvokableClass(): void
{
$formatter = new class ()
{
Expand Down Expand Up @@ -67,7 +67,7 @@ public function __invoke($faker, $attribute)
$this->assertEquals('Foo', $user1->first_name);
}

public function testThatFormattersCanBeAnInvokableClassString()
public function testThatFormattersCanBeAnInvokableClassString(): void
{
$formatter = new class ()
{
Expand Down Expand Up @@ -98,7 +98,7 @@ public function __invoke($faker, $attribute)
$this->assertEquals('Foo', $user1->first_name);
}

public function testThatArgumentsCanBePassedToFormatters()
public function testThatArgumentsCanBePassedToFormatters(): void
{
$this->app->config['carwash'] = [
'users' => [
Expand All @@ -119,7 +119,7 @@ public function testThatArgumentsCanBePassedToFormatters()
$this->assertEquals(3, str_word_count($user1->first_name));
}

public function testThatTheTableConfigurationCanBeAnInvokableClass()
public function testThatTheTableConfigurationCanBeAnInvokableClass(): void
{
$user = [
'id' => 1,
Expand Down Expand Up @@ -163,7 +163,7 @@ public function __invoke($faker, $record)
$this->assertEquals('Foo', $user1->first_name);
}

public function testThatTheTableConfigurationCanBeAnInvokableClassString()
public function testThatTheTableConfigurationCanBeAnInvokableClassString(): void
{
$user = [
'id' => 1,
Expand Down Expand Up @@ -200,7 +200,7 @@ public function __invoke($faker, $record)
$this->assertEquals('Foo', $user1->first_name);
}

public function testThatTheTableConfigurationCanBeAnAnonymousFunction()
public function testThatTheTableConfigurationCanBeAnAnonymousFunction(): void
{
$user = [
'id' => 1,
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use Orchestra\Testbench\TestCase as Orchestra;

class TestCase extends Orchestra
abstract class TestCase extends Orchestra
{
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
$this->setUpDatabase($this->app);
Expand Down

0 comments on commit 3950ab6

Please sign in to comment.