Skip to content

Commit

Permalink
Update PHPUnit (9.x -> 10.x)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakzal committed Nov 28, 2023
1 parent 3c37ebd commit 2907ebe
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 20 deletions.
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ infection:
.PHONY: infection

phpunit: tools/phpunit
tools/phpunit
.PHONY: phpunit

phpunit-coverage: tools/phpunit
phpdbg -qrr tools/phpunit
.PHONY: phpunit

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"psr/container": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"zalas/phpunit-globals": "^2.1",
"phpunit/phpunit": "^10.0",
"zalas/phpunit-globals": "^3.2",
"infection/infection": "^0.26"
},
"autoload": {
Expand Down
14 changes: 8 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php" beStrictAboutOutputDuringTests="true" beStrictAboutTodoAnnotatedTests="true" colors="true" verbose="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" bootstrap="vendor/autoload.php" beStrictAboutOutputDuringTests="true" beStrictAboutTodoAnnotatedTests="true" colors="true">
<coverage includeUncoveredFiles="true">
<report>
<clover outputFile="build/coverage.xml"/>
<html outputDirectory="build/coverage" lowUpperBound="50" highLowerBound="95"/>
Expand All @@ -20,7 +17,12 @@
<env name="TOOLBOX_EXCLUDED_TAGS" value="" force="true"/>
</php>
<extensions>
<extension class="Zalas\PHPUnit\Globals\AnnotationExtension"/>
<bootstrap class="Zalas\PHPUnit\Globals\AnnotationExtension"/>
</extensions>
<logging/>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
3 changes: 3 additions & 0 deletions tests/Cli/ServiceContainer/RunnerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Zalas\Toolbox\Tests\Cli\ServiceContainer;

use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerExceptionInterface;
Expand Down Expand Up @@ -89,6 +90,7 @@ public function test_it_creates_the_parametrised_runner_if_target_dir_option_is_
$this->assertInstanceOf(ParametrisedRunner::class, $runner);
}

#[DoesNotPerformAssertions]
public function test_the_parametrised_runner_includes_the_target_dir_parameter()
{
$this->givenInput(['--target-dir' => '/usr/local/bin', '--dry-run' => true]);
Expand All @@ -114,6 +116,7 @@ public function test_it_throws_an_exception_if_target_dir_does_not_exist()
$this->runnerFactory->createRunner();
}

#[DoesNotPerformAssertions]
public function test_it_uses_the_real_path_as_target_dir()
{
$this->givenInput(['--target-dir' => __DIR__.'/../../../bin', '--dry-run' => true]);
Expand Down
2 changes: 1 addition & 1 deletion tests/Cli/ServiceContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function test_it_creates_application_services(string $serviceId, string $
$this->assertInstanceOf($expectedType, $this->container->get($serviceId));
}

public function provideApplicationServices()
public static function provideApplicationServices()
{
yield [InstallCommand::class, InstallCommand::class];
yield [ListCommand::class, ListCommand::class];
Expand Down
2 changes: 1 addition & 1 deletion tests/Json/Factory/BoxBuildCommandFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function test_it_complains_if_any_of_required_properties_is_missing(strin
BoxBuildCommandFactory::import($properties);
}

public function provideRequiredProperties(): \Generator
public static function provideRequiredProperties(): \Generator
{
yield ['repository'];
yield ['phar'];
Expand Down
2 changes: 1 addition & 1 deletion tests/Json/Factory/ComposerBinPluginCommandFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function test_it_complains_if_any_of_required_properties_is_missing(strin
ComposerBinPluginCommandFactory::import($properties);
}

public function provideRequiredProperties(): \Generator
public static function provideRequiredProperties(): \Generator
{
yield ['package'];
yield ['namespace'];
Expand Down
2 changes: 1 addition & 1 deletion tests/Json/Factory/ComposerInstallCommandFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function test_it_complains_if_a_required_property_is_missing(string $prop
ComposerInstallCommandFactory::import($properties);
}

public function provideRequiredProperties()
public static function provideRequiredProperties()
{
yield ['repository'];
yield ['target-dir'];
Expand Down
2 changes: 1 addition & 1 deletion tests/Json/Factory/FileDownloadCommandFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function test_it_complains_if_any_of_required_properties_is_missing(strin
FileDownloadCommandFactory::import($properties);
}

public function provideRequiredProperties(): \Generator
public static function provideRequiredProperties(): \Generator
{
yield ['url'];
yield ['file'];
Expand Down
2 changes: 1 addition & 1 deletion tests/Json/Factory/PharDownloadCommandFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function test_it_complains_if_any_of_required_properties_is_missing(strin
PharDownloadCommandFactory::import($properties);
}

public function provideRequiredProperties(): \Generator
public static function provideRequiredProperties(): \Generator
{
yield ['phar'];
yield ['bin'];
Expand Down
2 changes: 1 addition & 1 deletion tests/Json/Factory/PhiveInstallCommandFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function test_it_accepts_unsigned_phars()
$this->assertStringContainsString('unsigned', (string)$command);
}

public function provideRequiredProperties(): \Generator
public static function provideRequiredProperties(): \Generator
{
yield ['alias'];
yield ['bin'];
Expand Down
2 changes: 1 addition & 1 deletion tests/Json/Factory/ToolFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function test_it_complains_if_any_of_required_properties_is_missing(strin
ToolFactory::import($properties);
}

public function provideRequiredProperties(): \Generator
public static function provideRequiredProperties(): \Generator
{
yield ['name'];
yield ['summary'];
Expand Down

0 comments on commit 2907ebe

Please sign in to comment.