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

@@ -17,13 +17,12 @@ use App\Export\Spreadsheet\Extractor\AnnotationExtractor;
use App\Export\Spreadsheet\Extractor\MetaFieldExtractor;
use App\Export\Spreadsheet\SpreadsheetExporter;
use App\Repository\Query\ActivityQuery;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @covers \App\Export\Spreadsheet\EntityWithMetaFieldsExporter
*/
#[CoversClass(EntityWithMetaFieldsExporter::class)]
class ActivityExporterTest extends TestCase
{
public function testExport(): void

View File

@@ -14,12 +14,11 @@ use App\Entity\Project;
use App\Export\Spreadsheet\AnnotatedObjectExporter;
use App\Export\Spreadsheet\Extractor\AnnotationExtractor;
use App\Export\Spreadsheet\SpreadsheetExporter;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @covers \App\Export\Spreadsheet\AnnotatedObjectExporter
*/
#[CoversClass(AnnotatedObjectExporter::class)]
class AnnotatedObjectExporterTest extends TestCase
{
public function testExport(): void

View File

@@ -12,10 +12,9 @@ namespace App\Tests\Export\Spreadsheet\CellFormatter;
use App\Export\Spreadsheet\CellFormatter\ArrayFormatter;
use App\Export\Spreadsheet\CellFormatter\CellFormatterInterface;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\Attributes\CoversClass;
/**
* @covers \App\Export\Spreadsheet\CellFormatter\ArrayFormatter
*/
#[CoversClass(ArrayFormatter::class)]
class ArrayFormatterTest extends AbstractFormatterTestCase
{
protected function getFormatter(): CellFormatterInterface

View File

@@ -12,10 +12,9 @@ namespace App\Tests\Export\Spreadsheet\CellFormatter;
use App\Export\Spreadsheet\CellFormatter\BooleanFormatter;
use App\Export\Spreadsheet\CellFormatter\CellFormatterInterface;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\Attributes\CoversClass;
/**
* @covers \App\Export\Spreadsheet\CellFormatter\BooleanFormatter
*/
#[CoversClass(BooleanFormatter::class)]
class BooleanFormatterTest extends AbstractFormatterTestCase
{
protected function getFormatter(): CellFormatterInterface

View File

@@ -15,10 +15,9 @@ use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\Style;
use PHPUnit\Framework\Attributes\CoversClass;
/**
* @covers \App\Export\Spreadsheet\CellFormatter\DateFormatter
*/
#[CoversClass(DateFormatter::class)]
class DateFormatterTest extends AbstractFormatterTestCase
{
private $date;

View File

@@ -14,10 +14,9 @@ use App\Export\Spreadsheet\CellFormatter\DateTimeFormatter;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Style;
use PHPUnit\Framework\Attributes\CoversClass;
/**
* @covers \App\Export\Spreadsheet\CellFormatter\DateTimeFormatter
*/
#[CoversClass(DateTimeFormatter::class)]
class DateTimeFormatterTest extends AbstractFormatterTestCase
{
private $date;

View File

@@ -14,10 +14,9 @@ use App\Export\Spreadsheet\CellFormatter\DurationFormatter;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Style;
use PHPUnit\Framework\Attributes\CoversClass;
/**
* @covers \App\Export\Spreadsheet\CellFormatter\DurationFormatter
*/
#[CoversClass(DurationFormatter::class)]
class DurationFormatterTest extends AbstractFormatterTestCase
{
protected function getFormatter(): CellFormatterInterface

View File

@@ -14,10 +14,9 @@ use App\Export\Spreadsheet\CellFormatter\StringFormatter;
use App\Tests\Utils\StringHelperTest;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\Attributes\CoversClass;
/**
* @covers \App\Export\Spreadsheet\CellFormatter\StringFormatter
*/
#[CoversClass(StringFormatter::class)]
class StringFormatterTest extends AbstractFormatterTestCase
{
protected function getFormatter(): CellFormatterInterface

View File

@@ -14,10 +14,9 @@ use App\Export\Spreadsheet\CellFormatter\TimeFormatter;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Style;
use PHPUnit\Framework\Attributes\CoversClass;
/**
* @covers \App\Export\Spreadsheet\CellFormatter\TimeFormatter
*/
#[CoversClass(TimeFormatter::class)]
class TimeFormatterTest extends AbstractFormatterTestCase
{
private $date;

View File

@@ -9,16 +9,16 @@
namespace App\Tests\Export\Spreadsheet;
use App\Export\Spreadsheet\ColumnDefinition;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Export\Spreadsheet\ColumnDefinition
*/
#[CoversClass(ColumnDefinition::class)]
class ColumnDefinitionTest extends TestCase
{
public function testConstruct(): void
{
$sut = new \App\Export\Spreadsheet\ColumnDefinition('foo', 'bar', function () {
$sut = new ColumnDefinition('foo', 'bar', function () {
return 'hello world';
});

View File

@@ -17,13 +17,12 @@ use App\Export\Spreadsheet\Extractor\AnnotationExtractor;
use App\Export\Spreadsheet\Extractor\MetaFieldExtractor;
use App\Export\Spreadsheet\SpreadsheetExporter;
use App\Repository\Query\CustomerQuery;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @covers \App\Export\Spreadsheet\EntityWithMetaFieldsExporter
*/
#[CoversClass(EntityWithMetaFieldsExporter::class)]
class CustomerExporterTest extends TestCase
{
public function testExport(): void

View File

@@ -18,13 +18,12 @@ use App\Export\Spreadsheet\Extractor\AnnotationExtractor;
use App\Export\Spreadsheet\Extractor\MetaFieldExtractor;
use App\Export\Spreadsheet\SpreadsheetExporter;
use App\Repository\Query\ProjectQuery;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @covers \App\Export\Spreadsheet\EntityWithMetaFieldsExporter
*/
#[CoversClass(EntityWithMetaFieldsExporter::class)]
class EntityWithMetaFieldsExporterTest extends TestCase
{
public function testExport(): void

View File

@@ -9,6 +9,8 @@
namespace App\Tests\Export\Spreadsheet\Extractor;
use App\Export\Annotation\Expose;
use App\Export\Annotation\Order;
use App\Export\Spreadsheet\ColumnDefinition;
use App\Export\Spreadsheet\Extractor\AnnotationExtractor;
use App\Export\Spreadsheet\Extractor\ExtractorException;
@@ -18,14 +20,13 @@ use App\Tests\Export\Spreadsheet\Entities\ExpressionOnProperty;
use App\Tests\Export\Spreadsheet\Entities\MethodRequiresParams;
use App\Tests\Export\Spreadsheet\Entities\MissingExpressionOnClass;
use App\Tests\Export\Spreadsheet\Entities\MissingNameOnClass;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Export\Spreadsheet\Extractor\AnnotationExtractor
* @covers \App\Export\Annotation\Expose
* @covers \App\Export\Annotation\Order
* @covers \App\Export\Spreadsheet\Extractor\ExtractorException
*/
#[CoversClass(AnnotationExtractor::class)]
#[CoversClass(Expose::class)]
#[CoversClass(Order::class)]
#[CoversClass(ExtractorException::class)]
class AnnotationExtractorTest extends TestCase
{
public function testExtract(): void

View File

@@ -16,13 +16,12 @@ use App\Export\Spreadsheet\ColumnDefinition;
use App\Export\Spreadsheet\Extractor\ExtractorException;
use App\Export\Spreadsheet\Extractor\MetaFieldExtractor;
use App\Repository\Query\ProjectQuery;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* @covers \App\Export\Spreadsheet\Extractor\MetaFieldExtractor
* @covers \App\Export\Spreadsheet\Extractor\ExtractorException
*/
#[CoversClass(MetaFieldExtractor::class)]
#[CoversClass(ExtractorException::class)]
class MetaFieldExtractorTest extends TestCase
{
public function testExtract(): void

View File

@@ -15,13 +15,12 @@ use App\Event\UserPreferenceDisplayEvent;
use App\Export\Spreadsheet\ColumnDefinition;
use App\Export\Spreadsheet\Extractor\ExtractorException;
use App\Export\Spreadsheet\Extractor\UserPreferenceExtractor;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* @covers \App\Export\Spreadsheet\Extractor\UserPreferenceExtractor
* @covers \App\Export\Spreadsheet\Extractor\ExtractorException
*/
#[CoversClass(UserPreferenceExtractor::class)]
#[CoversClass(ExtractorException::class)]
class UserPreferenceExtractorTest extends TestCase
{
public function testExtract(): void

View File

@@ -18,13 +18,12 @@ use App\Export\Spreadsheet\Extractor\AnnotationExtractor;
use App\Export\Spreadsheet\Extractor\MetaFieldExtractor;
use App\Export\Spreadsheet\SpreadsheetExporter;
use App\Repository\Query\ProjectQuery;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @covers \App\Export\Spreadsheet\EntityWithMetaFieldsExporter
*/
#[CoversClass(EntityWithMetaFieldsExporter::class)]
class ProjectExporterTest extends TestCase
{
public function testExport(): void

View File

@@ -14,12 +14,11 @@ use App\Export\Spreadsheet\CellFormatter\CellFormatterInterface;
use App\Export\Spreadsheet\ColumnDefinition;
use App\Export\Spreadsheet\SpreadsheetExporter;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @covers \App\Export\Spreadsheet\SpreadsheetExporter
*/
#[CoversClass(SpreadsheetExporter::class)]
class SpreadsheetExporterTest extends TestCase
{
public function testExport(): void

View File

@@ -15,13 +15,12 @@ use App\Export\Spreadsheet\Extractor\AnnotationExtractor;
use App\Export\Spreadsheet\Extractor\UserPreferenceExtractor;
use App\Export\Spreadsheet\SpreadsheetExporter;
use App\Export\Spreadsheet\UserExporter;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @covers \App\Export\Spreadsheet\UserExporter
*/
#[CoversClass(UserExporter::class)]
class UserExporterTest extends TestCase
{
public function testExport(): void

View File

@@ -12,11 +12,10 @@ namespace App\Tests\Export\Spreadsheet\Writer;
use App\Export\Spreadsheet\Writer\BinaryFileResponseWriter;
use App\Export\Spreadsheet\Writer\XlsxWriter;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Export\Spreadsheet\Writer\BinaryFileResponseWriter
*/
#[CoversClass(BinaryFileResponseWriter::class)]
class BinaryFileResponseWriterTest extends TestCase
{
public function testSave(): void

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Export\Spreadsheet\Writer;
use App\Export\Spreadsheet\Writer\XlsxWriter;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Export\Spreadsheet\Writer\XlsxWriter
*/
#[CoversClass(XlsxWriter::class)]
class XlsxWriterTest extends TestCase
{
public function testWriter(): void