Skip to content

Commit

Permalink
Migrate to PHPUnit 10
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Dec 5, 2023
1 parent 4e9b91f commit d88cef8
Show file tree
Hide file tree
Showing 25 changed files with 287 additions and 286 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/vendor
/composer.lock
/.phpunit.result.cache
/.phpunit.cache

# https://stackoverflow.com/a/16318111
/tools/*
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^9.0",
"phpunit/phpunit": "^10.5",
"php-coveralls/php-coveralls": "^2.2",
"vimeo/psalm": "5.17.0"
},
Expand Down
7 changes: 4 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="DateTime tests">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<coverage/>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion tests/Clock/OffsetClockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testOffsetClock(int $second, int $nano, string $duration, int $e
self::assertInstantIs($expectedSecond, $expectedNano, $clock->getTime());
}

public function providerOffsetClock(): array
public static function providerOffsetClock(): array
{
return [
[1000, 0, 'PT0.5S', 1000, 500000000],
Expand Down
2 changes: 1 addition & 1 deletion tests/Clock/ScaleClockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testScaleClock(int $second, int $nano, string $duration, int $sc
self::assertSame($expectedInstant, $actualTime->toDecimal());
}

public function providerScaleClock(): array
public static function providerScaleClock(): array
{
return [
[1000, 0, 'PT0.5S', 50, '1025'],
Expand Down
14 changes: 7 additions & 7 deletions tests/DayOfWeekTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testValues(int $expectedValue, DayOfWeek $dayOfWeek): void
self::assertSame($expectedValue, $dayOfWeek->getValue());
}

public function providerValues(): array
public static function providerValues(): array
{
return [
[1, DayOfWeek::MONDAY],
Expand Down Expand Up @@ -60,7 +60,7 @@ public function testOfInvalidDayOfWeekThrowsException(int $dayOfWeek): void
DayOfWeek::of($dayOfWeek);
}

public function providerOfInvalidDayOfWeekThrowsException(): array
public static function providerOfInvalidDayOfWeekThrowsException(): array
{
return [
[-1],
Expand All @@ -82,7 +82,7 @@ public function testNow(int $epochSecond, string $timeZone, DayOfWeek $expectedD
self::assertSame($expectedDayOfWeek, DayOfWeek::now(TimeZone::parse($timeZone), $clock));
}

public function providerNow(): array
public static function providerNow(): array
{
return [
[1388534399, '-01:00', DayOfWeek::TUESDAY],
Expand Down Expand Up @@ -168,7 +168,7 @@ public function testIsWeekday(DayOfWeek $dayOfWeek, bool $isWeekday): void
self::assertSame($isWeekday, $dayOfWeek->isWeekday());
}

public function providerIsWeekday(): array
public static function providerIsWeekday(): array
{
return [
[DayOfWeek::MONDAY, true],
Expand All @@ -189,7 +189,7 @@ public function testIsWeekend(DayOfWeek $dayOfWeek, bool $isWeekend): void
self::assertSame($isWeekend, $dayOfWeek->isWeekend());
}

public function providerIsWeekend(): array
public static function providerIsWeekend(): array
{
return [
[DayOfWeek::MONDAY, false],
Expand Down Expand Up @@ -226,7 +226,7 @@ public function testMinus(DayOfWeek $dayOfWeek, int $plusDays, DayOfWeek $expect
self::assertSame($expectedDayOfWeek, $dayOfWeek->minus(-$plusDays));
}

public function providerPlus(): Generator
public static function providerPlus(): Generator
{
for ($dayOfWeek = DayOfWeek::MONDAY->value; $dayOfWeek <= DayOfWeek::SUNDAY->value; $dayOfWeek++) {
for ($plusDays = -15; $plusDays <= 15; $plusDays++) {
Expand Down Expand Up @@ -266,7 +266,7 @@ public function testToString(DayOfWeek $dayOfWeek, string $expectedName): void
self::assertSame($expectedName, $dayOfWeek->toString());
}

public function providerToString(): array
public static function providerToString(): array
{
return [
[DayOfWeek::MONDAY, 'Monday'],
Expand Down
Loading

0 comments on commit d88cef8

Please sign in to comment.