Skip to content

Commit

Permalink
use phpunit v10
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan committed Feb 9, 2024
1 parent 19fc844 commit 4c5cf0b
Show file tree
Hide file tree
Showing 12 changed files with 370 additions and 338 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/.build/
/vendor/
/.php-cs-fixer.cache
/.phpunit.result.cache
/composer.lock
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'@Symfony:risky' => true,
'@PHP81Migration' => true,
'@PHP80Migration:risky' => true,
'@PHPUnit84Migration:risky' => true,
'@PHPUnit100Migration:risky' => true,

'array_indentation' => true,
'declare_strict_types' => true,
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"require-dev": {
"ext-intl": "*",
"friendsofphp/php-cs-fixer": "^3.49",
"phpunit/phpunit": "^9.6",
"phpunit/phpunit": "^10.5",
"vimeo/psalm": "^5.21"
},

Expand All @@ -45,8 +45,8 @@
"scripts": {
"cs": "php-cs-fixer fix -v",
"phpunit": "phpunit",
"phpunit-coverage": "phpdbg -qrr vendor/bin/phpunit --coverage-text",
"phpunit-coverage-html": "phpdbg -qrr vendor/bin/phpunit --coverage-html .build/coverage-html",
"phpunit-coverage": "phpunit --coverage-text",
"phpunit-coverage-html": "phpunit --coverage-html .build/coverage-html",
"psalm": "psalm",

"check": [
Expand Down
20 changes: 15 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
<?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"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="false"
beStrictAboutTodoAnnotatedTests="true"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerErrors="true"
failOnNotice="true"
failOnDeprecation="true"
failOnWarning="true"
failOnIncomplete="true"
failOnEmptyTestSuite="true"
colors="true"
verbose="true"
cacheDirectory=".build/.phpunit.cache"
>
<php>
<ini name="date.timezone" value="Europe/Berlin"/>
Expand All @@ -16,12 +26,12 @@
<directory>tests/</directory>
</testsuite>
</testsuites>
<coverage>
<source>
<include>
<directory>src/</directory>
</include>
<exclude>
<directory>src/Exception/</directory>
</exclude>
</coverage>
</source>
</phpunit>
8 changes: 5 additions & 3 deletions tests/Base/IntlFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@
namespace HillValley\Fluxcap\Tests\Base;

use HillValley\Fluxcap\Base\IntlFormatter;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

/**
* @internal
* @covers \HillValley\Fluxcap\Base\IntlFormatter
*/
#[CoversClass(IntlFormatter::class)]
final class IntlFormatterTest extends TestCase
{
protected function tearDown(): void
{
\Locale::setDefault('de-DE');
}

/** @dataProvider dataFormatDateTime */
#[DataProvider('dataFormatDateTime')]
public function testFormatDateTime(string $expected, string $dateTime, string $locale, int $dateFormat, int $timeFormat = \IntlDateFormatter::NONE): void
{
\Locale::setDefault($locale);
Expand All @@ -27,7 +29,7 @@ public function testFormatDateTime(string $expected, string $dateTime, string $l
self::assertSame($expected, IntlFormatter::formatDateTime($dateTime, $dateFormat, $timeFormat));
}

public function dataFormatDateTime(): iterable
public static function dataFormatDateTime(): iterable
{
return [
['03/09/2020', '2020-09-03', 'en-GB', \IntlDateFormatter::SHORT],
Expand Down
Loading

0 comments on commit 4c5cf0b

Please sign in to comment.