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

@@ -14,6 +14,7 @@ use App\Invoice\InvoiceItemHydrator;
use App\Invoice\InvoiceModel;
use App\Invoice\InvoiceModelHydrator;
use App\Model\InvoiceDocument;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Response;
@@ -27,9 +28,7 @@ class DebugRendererTest extends TestCase
yield [static fn (self $testCase) => $testCase->getInvoiceModelOneEntry(), '293.27', 1, 1, 0, 1, 0, false, []];
}
/**
* @dataProvider getTestModel
*/
#[DataProvider('getTestModel')]
public function testRender(callable $invoiceModel, $expectedRate, $expectedRows, $expectedDescriptions, $expectedUser1, $expectedUser2, $expectedUser3, $hasProject, $metaFields = []): void
{
/** @var InvoiceModel $model */

View File

@@ -9,15 +9,16 @@
namespace App\Tests\Invoice\Renderer;
use App\Invoice\Renderer\AbstractRenderer;
use App\Invoice\Renderer\DocxRenderer;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
/**
* @covers \App\Invoice\Renderer\DocxRenderer
* @covers \App\Invoice\Renderer\AbstractRenderer
* @group integration
*/
#[CoversClass(DocxRenderer::class)]
#[CoversClass(AbstractRenderer::class)]
#[Group('integration')]
class DocxRendererTest extends TestCase
{
use RendererTestTrait;

View File

@@ -10,16 +10,19 @@
namespace App\Tests\Invoice\Renderer;
use App\Invoice\InvoiceModel;
use App\Invoice\Renderer\AbstractRenderer;
use App\Invoice\Renderer\AbstractSpreadsheetRenderer;
use App\Invoice\Renderer\OdsRenderer;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
/**
* @covers \App\Invoice\Renderer\OdsRenderer
* @covers \App\Invoice\Renderer\AbstractRenderer
* @covers \App\Invoice\Renderer\AbstractSpreadsheetRenderer
* @group integration
*/
#[CoversClass(OdsRenderer::class)]
#[CoversClass(AbstractRenderer::class)]
#[CoversClass(AbstractSpreadsheetRenderer::class)]
#[Group('integration')]
class OdsRendererTest extends TestCase
{
use RendererTestTrait;
@@ -42,9 +45,7 @@ class OdsRendererTest extends TestCase
yield [static fn (self $testCase) => $testCase->getInvoiceModelOneEntry(), '293.27', 2, 1, 0, 1, 0];
}
/**
* @dataProvider getTestModel
*/
#[DataProvider('getTestModel')]
public function testRender(callable $invoiceModel, $expectedRate, $expectedRows, $expectedDescriptions, $expectedUser1, $expectedUser2, $expectedUser3): void
{
/** @var InvoiceModel $model */

View File

@@ -9,11 +9,14 @@
namespace App\Tests\Invoice\Renderer;
use App\Invoice\Renderer\AbstractTwigRenderer;
use App\Invoice\Renderer\PdfRenderer;
use App\Model\InvoiceDocument;
use App\Pdf\HtmlToPdfConverter;
use App\Pdf\MPdfConverter;
use App\Tests\Mocks\FileHelperFactory;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -21,11 +24,9 @@ use Twig\Environment;
use Twig\Loader\ArrayLoader;
use Twig\Loader\FilesystemLoader;
/**
* @covers \App\Invoice\Renderer\AbstractTwigRenderer
* @covers \App\Invoice\Renderer\PdfRenderer
* @group integration
*/
#[CoversClass(AbstractTwigRenderer::class)]
#[CoversClass(PdfRenderer::class)]
#[Group('integration')]
class PdfRendererTest extends KernelTestCase
{
use RendererTestTrait;

View File

@@ -9,19 +9,20 @@
namespace App\Tests\Invoice\Renderer;
use App\Invoice\Renderer\AbstractTwigRenderer;
use App\Invoice\Renderer\TwigRenderer;
use App\Model\InvoiceDocument;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
/**
* @covers \App\Invoice\Renderer\AbstractTwigRenderer
* @covers \App\Invoice\Renderer\TwigRenderer
* @group integration
*/
#[CoversClass(AbstractTwigRenderer::class)]
#[CoversClass(TwigRenderer::class)]
#[Group('integration')]
class TwigRendererTest extends KernelTestCase
{
use RendererTestTrait;

View File

@@ -10,17 +10,21 @@
namespace App\Tests\Invoice\Renderer;
use App\Invoice\InvoiceModel;
use App\Invoice\Renderer\AbstractRenderer;
use App\Invoice\Renderer\AbstractSpreadsheetRenderer;
use App\Invoice\Renderer\AdvancedValueBinder;
use App\Invoice\Renderer\XlsxRenderer;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
/**
* @covers \App\Invoice\Renderer\XlsxRenderer
* @covers \App\Invoice\Renderer\AbstractRenderer
* @covers \App\Invoice\Renderer\AbstractSpreadsheetRenderer
* @covers \App\Invoice\Renderer\AdvancedValueBinder
* @group integration
*/
#[CoversClass(XlsxRenderer::class)]
#[CoversClass(AbstractRenderer::class)]
#[CoversClass(AbstractSpreadsheetRenderer::class)]
#[CoversClass(AdvancedValueBinder::class)]
#[Group('integration')]
class XlsxRendererTest extends TestCase
{
use RendererTestTrait;
@@ -43,9 +47,7 @@ class XlsxRendererTest extends TestCase
yield [static fn (self $testCase) => $testCase->getInvoiceModelOneEntry(), '293.27', 2, 1, 0, 1, 0];
}
/**
* @dataProvider getTestModel
*/
#[DataProvider('getTestModel')]
public function testRender(callable $invoiceModel, $expectedRate, $expectedRows, $expectedDescriptions, $expectedUser1, $expectedUser2, $expectedUser3): void
{
/** @var InvoiceModel $model */