replace PHPUnit annotations with attributes (#5608)
This commit is contained in:
@@ -9,17 +9,17 @@
|
||||
|
||||
namespace App\Tests\Twig;
|
||||
|
||||
use App\Configuration\SystemConfiguration;
|
||||
use App\Tests\Configuration\TestConfigLoader;
|
||||
use App\Tests\Mocks\SystemConfigurationFactory;
|
||||
use App\Twig\Context;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
/**
|
||||
* @covers \App\Twig\Context
|
||||
* @covers \App\Configuration\SystemConfiguration
|
||||
*/
|
||||
#[CoversClass(Context::class)]
|
||||
#[CoversClass(SystemConfiguration::class)]
|
||||
class ContextTest extends TestCase
|
||||
{
|
||||
protected function getSut(array $settings, array $headers = []): Context
|
||||
|
||||
@@ -12,12 +12,11 @@ namespace App\Tests\Twig;
|
||||
use App\Repository\BookmarkRepository;
|
||||
use App\Twig\DatatableExtensions;
|
||||
use App\Utils\ProfileManager;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
/**
|
||||
* @covers \App\Twig\DatatableExtensions
|
||||
*/
|
||||
#[CoversClass(DatatableExtensions::class)]
|
||||
class DatatableExtensionsTest extends TestCase
|
||||
{
|
||||
protected function getSut(string $locale): DatatableExtensions
|
||||
|
||||
@@ -13,15 +13,15 @@ use App\Constants;
|
||||
use App\Entity\Activity;
|
||||
use App\Entity\User;
|
||||
use App\Twig\Extensions;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Node\TextNode;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\TwigFunction;
|
||||
use Twig\TwigTest;
|
||||
|
||||
/**
|
||||
* @covers \App\Twig\Extensions
|
||||
*/
|
||||
#[CoversClass(Extensions::class)]
|
||||
class ExtensionsTest extends TestCase
|
||||
{
|
||||
protected function getSut(): Extensions
|
||||
@@ -149,9 +149,7 @@ sdfsdf' . PHP_EOL . "\n" .
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getMultilineTestData
|
||||
*/
|
||||
#[DataProvider('getMultilineTestData')]
|
||||
public function testMultilineIndent($indent, $string, $expected): void
|
||||
{
|
||||
$sut = $this->getSut();
|
||||
@@ -211,9 +209,7 @@ sdfsdf' . PHP_EOL . "\n" .
|
||||
yield [' – ', "foo\r\nbar\rtest\nhello", 'foo – bar – test – hello'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getTestDataReplaceNewline
|
||||
*/
|
||||
#[DataProvider('getTestDataReplaceNewline')]
|
||||
public function testReplaceNewline(string $replacer, $input, $expected): void
|
||||
{
|
||||
$sut = $this->getSut();
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -12,13 +12,12 @@ namespace App\Tests\Twig;
|
||||
use App\Twig\PaginationExtension;
|
||||
use App\Utils\Pagination;
|
||||
use Pagerfanta\Adapter\ArrayAdapter;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
/**
|
||||
* @covers \App\Twig\PaginationExtension
|
||||
*/
|
||||
#[CoversClass(PaginationExtension::class)]
|
||||
class PaginationExtensionTest extends TestCase
|
||||
{
|
||||
private function getUrlGenerator(): UrlGeneratorInterface
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
namespace App\Tests\Twig\Runtime;
|
||||
|
||||
use App\Twig\Runtime\EncoreExtension;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupInterface;
|
||||
|
||||
/**
|
||||
* @covers \App\Twig\Runtime\EncoreExtension
|
||||
*/
|
||||
#[CoversClass(EncoreExtension::class)]
|
||||
class EncoreExtensionTest extends TestCase
|
||||
{
|
||||
protected function getSut(array $files = []): EncoreExtension
|
||||
|
||||
@@ -13,11 +13,10 @@ use App\Configuration\ConfigLoaderInterface;
|
||||
use App\Tests\Mocks\SystemConfigurationFactory;
|
||||
use App\Twig\Runtime\MarkdownExtension;
|
||||
use App\Utils\Markdown;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Twig\Runtime\MarkdownExtension
|
||||
*/
|
||||
#[CoversClass(MarkdownExtension::class)]
|
||||
class MarkdownExtensionTest extends TestCase
|
||||
{
|
||||
public function testMarkdownToHtml(): void
|
||||
|
||||
@@ -15,6 +15,8 @@ use App\Tests\Configuration\TestConfigLoader;
|
||||
use App\Tests\Event\ThemeJavascriptTranslationsEventTest;
|
||||
use App\Tests\Mocks\SystemConfigurationFactory;
|
||||
use App\Twig\Runtime\ThemeExtension;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bridge\Twig\AppVariable;
|
||||
@@ -26,9 +28,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
|
||||
/**
|
||||
* @covers \App\Twig\Runtime\ThemeExtension
|
||||
*/
|
||||
#[CoversClass(ThemeExtension::class)]
|
||||
class ThemeEventExtensionTest extends TestCase
|
||||
{
|
||||
private function getDefaultSettings(): array
|
||||
@@ -135,9 +135,7 @@ class ThemeEventExtensionTest extends TestCase
|
||||
yield ['', 0, true];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getProgressbarColors
|
||||
*/
|
||||
#[DataProvider('getProgressbarColors')]
|
||||
public function testProgressbarClass(string $expected, int $percent, ?bool $reverseColors = false): void
|
||||
{
|
||||
$sut = $this->getSut(false);
|
||||
|
||||
@@ -15,11 +15,10 @@ use App\Repository\BookmarkRepository;
|
||||
use App\Repository\TimesheetRepository;
|
||||
use App\Timesheet\FavoriteRecordService;
|
||||
use App\Twig\Runtime\TimesheetExtension;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Twig\Runtime\TimesheetExtension
|
||||
*/
|
||||
#[CoversClass(TimesheetExtension::class)]
|
||||
class TimesheetExtensionTest extends TestCase
|
||||
{
|
||||
public function testActiveEntries(): void
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Entity\User;
|
||||
use App\Tests\Widget\Type\More;
|
||||
use App\Twig\Runtime\WidgetExtension;
|
||||
use App\Widget\WidgetService;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
@@ -20,9 +21,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Twig\Environment;
|
||||
|
||||
/**
|
||||
* @covers \App\Twig\Runtime\WidgetExtension
|
||||
*/
|
||||
#[CoversClass(WidgetExtension::class)]
|
||||
class WidgetExtensionTest extends TestCase
|
||||
{
|
||||
protected function getSut($hasWidget = null, $getWidget = null): WidgetExtension
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
namespace App\Tests\Twig;
|
||||
|
||||
use App\Twig\RuntimeExtensions;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Node\TextNode;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
/**
|
||||
* @covers \App\Twig\RuntimeExtensions
|
||||
*/
|
||||
#[CoversClass(RuntimeExtensions::class)]
|
||||
class RuntimeExtensionsTest extends TestCase
|
||||
{
|
||||
public function testGetFilters(): void
|
||||
|
||||
Reference in New Issue
Block a user