replace PHPUnit annotations with attributes (#5608)

This commit is contained in:
Kevin Papst
2025-08-11 18:57:42 +02:00
committed by GitHub
parent 04331420ae
commit 24778d3ffb
599 changed files with 1778 additions and 2313 deletions

View File

@@ -13,16 +13,17 @@ use App\Configuration\LocaleService;
use App\Entity\Timesheet;
use App\Entity\User;
use App\Twig\LocaleFormatExtensions;
use App\Utils\LocaleFormatter;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Twig\TwigFilter;
use Twig\TwigFunction;
use Twig\TwigTest;
/**
* @covers \App\Twig\LocaleFormatExtensions
* @covers \App\Utils\LocaleFormatter
*/
#[CoversClass(LocaleFormatExtensions::class)]
#[CoversClass(LocaleFormatter::class)]
class LocaleFormatExtensionsTest extends TestCase
{
private array $localeEn = ['en' => ['date' => 'Y-m-d', 'duration' => '%h:%m', 'time' => 'h:mm a']];
@@ -124,9 +125,7 @@ class LocaleFormatExtensionsTest extends TestCase
}
}
/**
* @dataProvider getDateShortData
*/
#[DataProvider('getDateShortData')]
public function testDateShort(string $locale, \DateTime|string|null $date, string $expected): void
{
$sut = $this->getSut($locale, [
@@ -155,9 +154,7 @@ class LocaleFormatExtensionsTest extends TestCase
];
}
/**
* @dataProvider getDateTimeData
*/
#[DataProvider('getDateTimeData')]
public function testDateTime(string $locale, \DateTime|string|null $date, string $expected): void
{
$sut = $this->getSut($locale, [
@@ -184,9 +181,7 @@ class LocaleFormatExtensionsTest extends TestCase
];
}
/**
* @dataProvider getDayNameTestData
*/
#[DataProvider('getDayNameTestData')]
public function testDayName(string $locale, string $date, string $expectedName, bool $short): void
{
$sut = $this->getSut($locale, []);
@@ -206,9 +201,7 @@ class LocaleFormatExtensionsTest extends TestCase
];
}
/**
* @dataProvider getMonthNameTestData
*/
#[DataProvider('getMonthNameTestData')]
public function testMonthName(string $locale, string $date, string $expectedName, bool $withYear = false): void
{
$sut = $this->getSut($locale, []);
@@ -282,9 +275,7 @@ class LocaleFormatExtensionsTest extends TestCase
self::assertEquals('123.234,76', $sut->money(123234.7554, 'EUR', false));
}
/**
* @dataProvider getMoneyNoCurrencyData
*/
#[DataProvider('getMoneyNoCurrencyData')]
public function testMoneyNoCurrency($result, $amount, $currency, $locale): void
{
$sut = $this->getSut($locale, $this->localeEn);
@@ -316,9 +307,7 @@ class LocaleFormatExtensionsTest extends TestCase
];
}
/**
* @dataProvider getMoneyData
*/
#[DataProvider('getMoneyData')]
public function testMoney(string $result, float|int|null $amount, string $currency, string $locale): void
{
$sut = $this->getSut($locale, $this->localeEn);
@@ -349,9 +338,7 @@ class LocaleFormatExtensionsTest extends TestCase
];
}
/**
* @dataProvider getAmountData
*/
#[DataProvider('getAmountData')]
public function testAmount(string $result, null|int|float|string $amount, string $locale): void
{
$sut = $this->getSut($locale, $this->localeEn);
@@ -378,9 +365,7 @@ class LocaleFormatExtensionsTest extends TestCase
];
}
/**
* @dataProvider getMoneyData62_1
*/
#[DataProvider('getMoneyData62_1')]
public function testMoney621(string $result, null|int|float $amount, string $currency, string $locale): void
{
IntlTestHelper::requireFullIntl($this, '62.1');