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,15 +14,16 @@ use App\Repository\ActivityRepository;
use App\Tests\Mocks\SystemConfigurationFactory;
use App\Validator\Constraints\Activity as ActivityConstraint;
use App\Validator\Constraints\ActivityValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\Activity
* @covers \App\Validator\Constraints\ActivityValidator
* @extends ConstraintValidatorTestCase<ActivityValidator>
*/
#[CoversClass(ActivityConstraint::class)]
#[CoversClass(ActivityValidator::class)]
class ActivityValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): ActivityValidator

View File

@@ -11,15 +11,17 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\ColorChoices;
use App\Validator\Constraints\ColorChoicesValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\ColorChoices
* @covers \App\Validator\Constraints\ColorChoicesValidator
* @extends ConstraintValidatorTestCase<ColorChoicesValidator>
*/
#[CoversClass(ColorChoices::class)]
#[CoversClass(ColorChoicesValidator::class)]
class ColorChoicesValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): ColorChoicesValidator
@@ -47,9 +49,7 @@ class ColorChoicesValidatorTest extends ConstraintValidatorTestCase
$this->validator->validate('#000', new NotBlank());
}
/**
* @dataProvider getValidColors
*/
#[DataProvider('getValidColors')]
public function testConstraintWithValidColor(?string $color): void
{
$constraint = new ColorChoices();
@@ -77,12 +77,12 @@ class ColorChoicesValidatorTest extends ConstraintValidatorTestCase
}
/**
* @dataProvider getInvalidColors
* @param string $color
* @param string|null $invalidColor
* @param string|null $invalidName
* @param string|null $invalidNameCode
*/
#[DataProvider('getInvalidColors')]
public function testValidationError(string $color, $invalidColor = null, $invalidName = null, $invalidNameCode = null): void
{
$constraint = new ColorChoices();

View File

@@ -14,15 +14,16 @@ use App\Repository\CustomerRepository;
use App\Tests\Mocks\SystemConfigurationFactory;
use App\Validator\Constraints\Customer as CustomerConstraint;
use App\Validator\Constraints\CustomerValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\Customer
* @covers \App\Validator\Constraints\CustomerValidator
* @extends ConstraintValidatorTestCase<CustomerValidator>
*/
#[CoversClass(CustomerConstraint::class)]
#[CoversClass(CustomerValidator::class)]
class CustomerValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): CustomerValidator

View File

@@ -11,15 +11,17 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\DateTimeFormat;
use App\Validator\Constraints\DateTimeFormatValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\DateTimeFormat
* @covers \App\Validator\Constraints\DateTimeFormatValidator
* @extends ConstraintValidatorTestCase<DateTimeFormatValidator>
*/
#[CoversClass(DateTimeFormat::class)]
#[CoversClass(DateTimeFormatValidator::class)]
class DateTimeFormatValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): DateTimeFormatValidator
@@ -46,9 +48,7 @@ class DateTimeFormatValidatorTest extends ConstraintValidatorTestCase
$this->validator->validate('foo', new NotBlank());
}
/**
* @dataProvider getValidData
*/
#[DataProvider('getValidData')]
public function testConstraintWithValidData(?string $input): void
{
$constraint = new DateTimeFormat();
@@ -67,9 +67,7 @@ class DateTimeFormatValidatorTest extends ConstraintValidatorTestCase
];
}
/**
* @dataProvider getInvalidData
*/
#[DataProvider('getInvalidData')]
public function testValidationError(?string $input): void
{
$constraint = new DateTimeFormat();

View File

@@ -11,16 +11,18 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\Duration;
use App\Validator\Constraints\DurationValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Regex;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\Duration
* @covers \App\Validator\Constraints\DurationValidator
* @extends ConstraintValidatorTestCase<DurationValidator>
*/
#[CoversClass(Duration::class)]
#[CoversClass(DurationValidator::class)]
class DurationValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): DurationValidator
@@ -65,9 +67,7 @@ class DurationValidatorTest extends ConstraintValidatorTestCase
$this->validator->validate('foo', new NotBlank());
}
/**
* @dataProvider getValidData
*/
#[DataProvider('getValidData')]
public function testConstraintWithValidData(string|int|null $input): void
{
$constraint = new Duration();
@@ -99,9 +99,7 @@ class DurationValidatorTest extends ConstraintValidatorTestCase
];
}
/**
* @dataProvider getInvalidData
*/
#[DataProvider('getInvalidData')]
public function testValidationError(string $input): void
{
$constraint = new Duration([
@@ -117,9 +115,7 @@ class DurationValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
/**
* @dataProvider getInvalidData
*/
#[DataProvider('getInvalidData')]
public function testValidationErrorUpperCase(string $input): void
{
$input = strtoupper($input);

View File

@@ -11,15 +11,17 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\ExportRenderer;
use App\Validator\Constraints\ExportRendererValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\ExportRenderer
* @covers \App\Validator\Constraints\ExportRendererValidator
* @extends ConstraintValidatorTestCase<ExportRendererValidator>
*/
#[CoversClass(ExportRenderer::class)]
#[CoversClass(ExportRendererValidator::class)]
class ExportRendererValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): ExportRendererValidator
@@ -41,9 +43,7 @@ class ExportRendererValidatorTest extends ConstraintValidatorTestCase
$this->validator->validate('#000', new NotBlank());
}
/**
* @dataProvider getValidColors
*/
#[DataProvider('getValidColors')]
public function testConstraintWithValidColor(?string $color): void
{
$constraint = new ExportRenderer();
@@ -69,9 +69,7 @@ class ExportRendererValidatorTest extends ConstraintValidatorTestCase
yield [[], 'array'];
}
/**
* @dataProvider getInvalidColors
*/
#[DataProvider('getInvalidColors')]
public function testValidationError(mixed $color, ?string $parameterType = null): void
{
$constraint = new ExportRenderer();

View File

@@ -11,15 +11,17 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\HexColor;
use App\Validator\Constraints\HexColorValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\HexColor
* @covers \App\Validator\Constraints\HexColorValidator
* @extends ConstraintValidatorTestCase<HexColorValidator>
*/
#[CoversClass(HexColor::class)]
#[CoversClass(HexColorValidator::class)]
class HexColorValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): HexColorValidator
@@ -46,9 +48,7 @@ class HexColorValidatorTest extends ConstraintValidatorTestCase
$this->validator->validate('#000', new NotBlank());
}
/**
* @dataProvider getValidColors
*/
#[DataProvider('getValidColors')]
public function testConstraintWithValidColor(?string $color): void
{
$constraint = new HexColor();
@@ -74,9 +74,7 @@ class HexColorValidatorTest extends ConstraintValidatorTestCase
yield [[], 'array'];
}
/**
* @dataProvider getInvalidColors
*/
#[DataProvider('getInvalidColors')]
public function testValidationError(mixed $color, ?string $parameterType = null): void
{
$constraint = new HexColor();

View File

@@ -15,15 +15,16 @@ use App\Repository\ProjectRepository;
use App\Tests\Mocks\SystemConfigurationFactory;
use App\Validator\Constraints\Project as ProjectConstraint;
use App\Validator\Constraints\ProjectValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\Project
* @covers \App\Validator\Constraints\ProjectValidator
* @extends ConstraintValidatorTestCase<ProjectValidator>
*/
#[CoversClass(\App\Validator\Constraints\Project::class)]
#[CoversClass(ProjectValidator::class)]
class ProjectValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): ProjectValidator

View File

@@ -16,15 +16,16 @@ use App\Entity\User;
use App\Model\QuickEntryModel as QuickEntryModelEntity;
use App\Validator\Constraints\QuickEntryModel;
use App\Validator\Constraints\QuickEntryModelValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\QuickEntryModel
* @covers \App\Validator\Constraints\QuickEntryModelValidator
* @extends ConstraintValidatorTestCase<QuickEntryModelValidator>
*/
#[CoversClass(\App\Validator\Constraints\QuickEntryModel::class)]
#[CoversClass(QuickEntryModelValidator::class)]
class QuickEntryModelValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): QuickEntryModelValidator

View File

@@ -14,16 +14,17 @@ use App\Entity\Timesheet;
use App\Validator\Constraints\QuickEntryTimesheet;
use App\Validator\Constraints\QuickEntryTimesheetValidator;
use App\Validator\Constraints\TimesheetBasic;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ConstraintValidatorInterface;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\QuickEntryTimesheet
* @covers \App\Validator\Constraints\QuickEntryTimesheetValidator
* @extends ConstraintValidatorTestCase<QuickEntryTimesheetValidator>
*/
#[CoversClass(QuickEntryTimesheet::class)]
#[CoversClass(QuickEntryTimesheetValidator::class)]
class QuickEntryTimesheetValidatorTest extends ConstraintValidatorTestCase
{
protected function createConstraint(): QuickEntryTimesheet

View File

@@ -13,15 +13,17 @@ use App\Entity\User;
use App\Tests\Mocks\Security\RoleServiceFactory;
use App\Validator\Constraints\RoleName;
use App\Validator\Constraints\RoleNameValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\RoleName
* @covers \App\Validator\Constraints\RoleNameValidator
* @extends ConstraintValidatorTestCase<RoleNameValidator>
*/
#[CoversClass(RoleName::class)]
#[CoversClass(RoleNameValidator::class)]
class RoleNameValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): RoleNameValidator
@@ -52,9 +54,7 @@ class RoleNameValidatorTest extends ConstraintValidatorTestCase
$this->validator->validate('foo', new NotBlank());
}
/**
* @dataProvider getValidRoleNames
*/
#[DataProvider('getValidRoleNames')]
public function testConstraintWithValidRole(string $role): void
{
$constraint = new RoleName();
@@ -96,9 +96,7 @@ class RoleNameValidatorTest extends ConstraintValidatorTestCase
];
}
/**
* @dataProvider getInvalidRoleNames
*/
#[DataProvider('getInvalidRoleNames')]
public function testValidationError(string|int $role): void
{
$constraint = new RoleName([

View File

@@ -13,15 +13,17 @@ use App\Entity\User;
use App\Tests\Mocks\Security\RoleServiceFactory;
use App\Validator\Constraints\Role;
use App\Validator\Constraints\RoleValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\Role
* @covers \App\Validator\Constraints\RoleValidator
* @extends ConstraintValidatorTestCase<RoleValidator>
*/
#[CoversClass(Role::class)]
#[CoversClass(RoleValidator::class)]
class RoleValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): RoleValidator
@@ -49,9 +51,7 @@ class RoleValidatorTest extends ConstraintValidatorTestCase
$this->validator->validate('foo', new NotBlank());
}
/**
* @dataProvider getValidRoles
*/
#[DataProvider('getValidRoles')]
public function testConstraintWithValidRole(string $role): void
{
$constraint = new Role();
@@ -81,9 +81,7 @@ class RoleValidatorTest extends ConstraintValidatorTestCase
];
}
/**
* @dataProvider getInvalidRoles
*/
#[DataProvider('getInvalidRoles')]
public function testValidationError(mixed $role): void
{
$constraint = new Role([

View File

@@ -14,15 +14,16 @@ use App\Entity\TeamMember;
use App\Entity\User;
use App\Validator\Constraints\Team as TeamConstraint;
use App\Validator\Constraints\TeamValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\Team
* @covers \App\Validator\Constraints\TeamValidator
* @extends ConstraintValidatorTestCase<TeamValidator>
*/
#[CoversClass(\App\Validator\Constraints\Team::class)]
#[CoversClass(TeamValidator::class)]
class TeamValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TeamValidator

View File

@@ -11,16 +11,18 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimeFormat;
use App\Validator\Constraints\TimeFormatValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\UnexpectedValueException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimeFormat
* @covers \App\Validator\Constraints\TimeFormatValidator
* @extends ConstraintValidatorTestCase<TimeFormatValidator>
*/
#[CoversClass(TimeFormat::class)]
#[CoversClass(TimeFormatValidator::class)]
class TimeFormatValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimeFormatValidator
@@ -43,9 +45,7 @@ class TimeFormatValidatorTest extends ConstraintValidatorTestCase
$this->validator->validate(new \stdClass(), new TimeFormat());
}
/**
* @dataProvider getValidTimes
*/
#[DataProvider('getValidTimes')]
public function testValidationSucceeds(?string $value): void
{
$this->validator->validate($value, new TimeFormat());
@@ -66,9 +66,7 @@ class TimeFormatValidatorTest extends ConstraintValidatorTestCase
];
}
/**
* @dataProvider getInvalidTimes
*/
#[DataProvider('getInvalidTimes')]
public function testValidationProblem(?string $value): void
{
$this->validator->validate($value, new TimeFormat());

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimesheetBasic;
use App\Validator\Constraints\TimesheetConstraint;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Validator\Constraints\TimesheetBasic
*/
#[CoversClass(TimesheetBasic::class)]
class TimesheetBasicTest extends TestCase
{
public function testIsTimesheetConstraint(): void

View File

@@ -16,15 +16,17 @@ use App\Entity\Timesheet;
use App\Tests\Mocks\SystemConfigurationFactory;
use App\Validator\Constraints\TimesheetBasic;
use App\Validator\Constraints\TimesheetBasicValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetBasic
* @covers \App\Validator\Constraints\TimesheetBasicValidator
* @extends ConstraintValidatorTestCase<TimesheetBasicValidator>
*/
#[CoversClass(TimesheetBasic::class)]
#[CoversClass(TimesheetBasicValidator::class)]
class TimesheetBasicValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetBasicValidator
@@ -169,9 +171,7 @@ class TimesheetBasicValidatorTest extends ConstraintValidatorTestCase
]];
}
/**
* @dataProvider getProjectStartEndTestData
*/
#[DataProvider('getProjectStartEndTestData')]
public function testEndBeforeWithProjectStartAndEnd(\DateTime $start, \DateTime $end, array $violations): void
{
$timesheet = new Timesheet();

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimesheetBudgetUsed;
use App\Validator\Constraints\TimesheetConstraint;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Validator\Constraints\TimesheetBudgetUsed
*/
#[CoversClass(TimesheetBudgetUsed::class)]
class TimesheetBudgetUsedTest extends TestCase
{
public function testIsTimesheetConstraint(): void

View File

@@ -32,16 +32,18 @@ use App\Timesheet\RateServiceInterface;
use App\Validator\Constraints\TimesheetBudgetUsed;
use App\Validator\Constraints\TimesheetBudgetUsedValidator;
use DateTime;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetBudgetUsed
* @covers \App\Validator\Constraints\TimesheetBudgetUsedValidator
* @extends ConstraintValidatorTestCase<TimesheetBudgetUsedValidator>
*/
#[CoversClass(TimesheetBudgetUsed::class)]
#[CoversClass(TimesheetBudgetUsedValidator::class)]
class TimesheetBudgetUsedValidatorTest extends ConstraintValidatorTestCase
{
/**
@@ -268,9 +270,7 @@ class TimesheetBudgetUsedValidatorTest extends ConstraintValidatorTestCase
];
}
/**
* @dataProvider getViolationTestData
*/
#[DataProvider('getViolationTestData')]
public function testWithActivityTimeBudget(
?int $activityDuration,
?float $activityRate,

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimesheetConstraint;
use App\Validator\Constraints\TimesheetDeactivated;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Validator\Constraints\TimesheetDeactivated
*/
#[CoversClass(TimesheetDeactivated::class)]
class TimesheetDeactivatedTest extends TestCase
{
public function testIsTimesheetConstraint(): void

View File

@@ -15,15 +15,16 @@ use App\Entity\Project;
use App\Entity\Timesheet;
use App\Validator\Constraints\TimesheetDeactivated;
use App\Validator\Constraints\TimesheetDeactivatedValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetDeactivated
* @covers \App\Validator\Constraints\TimesheetDeactivatedValidator
* @extends ConstraintValidatorTestCase<TimesheetDeactivatedValidator>
*/
#[CoversClass(TimesheetDeactivated::class)]
#[CoversClass(TimesheetDeactivatedValidator::class)]
class TimesheetDeactivatedValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetDeactivatedValidator

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimesheetConstraint;
use App\Validator\Constraints\TimesheetExported;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Validator\Constraints\TimesheetExported
*/
#[CoversClass(TimesheetExported::class)]
class TimesheetExportedTest extends TestCase
{
public function testIsTimesheetConstraint(): void

View File

@@ -13,16 +13,17 @@ use App\Entity\Timesheet;
use App\Entity\User;
use App\Validator\Constraints\TimesheetExported;
use App\Validator\Constraints\TimesheetExportedValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetExported
* @covers \App\Validator\Constraints\TimesheetExportedValidator
* @extends ConstraintValidatorTestCase<TimesheetExportedValidator>
*/
#[CoversClass(TimesheetExported::class)]
#[CoversClass(TimesheetExportedValidator::class)]
class TimesheetExportedValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetExportedValidator

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimesheetConstraint;
use App\Validator\Constraints\TimesheetFutureTimes;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Validator\Constraints\TimesheetFutureTimes
*/
#[CoversClass(TimesheetFutureTimes::class)]
class TimesheetFutureTimesTest extends TestCase
{
public function testIsTimesheetConstraint(): void

View File

@@ -14,15 +14,16 @@ use App\Entity\Timesheet;
use App\Tests\Mocks\SystemConfigurationFactory;
use App\Validator\Constraints\TimesheetFutureTimes;
use App\Validator\Constraints\TimesheetFutureTimesValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetFutureTimes
* @covers \App\Validator\Constraints\TimesheetFutureTimesValidator
* @extends ConstraintValidatorTestCase<TimesheetFutureTimesValidator>
*/
#[CoversClass(TimesheetFutureTimes::class)]
#[CoversClass(TimesheetFutureTimesValidator::class)]
class TimesheetFutureTimesValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetFutureTimesValidator

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimesheetConstraint;
use App\Validator\Constraints\TimesheetLockdown;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Validator\Constraints\TimesheetLockdown
*/
#[CoversClass(TimesheetLockdown::class)]
class TimesheetLockdownTest extends TestCase
{
public function testIsTimesheetConstraint(): void

View File

@@ -16,16 +16,18 @@ use App\Tests\Mocks\SystemConfigurationFactory;
use App\Timesheet\LockdownService;
use App\Validator\Constraints\TimesheetLockdown;
use App\Validator\Constraints\TimesheetLockdownValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetLockdown
* @covers \App\Validator\Constraints\TimesheetLockdownValidator
* @extends ConstraintValidatorTestCase<TimesheetLockdownValidator>
*/
#[CoversClass(TimesheetLockdown::class)]
#[CoversClass(TimesheetLockdownValidator::class)]
class TimesheetLockdownValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetLockdownValidator
@@ -141,9 +143,7 @@ class TimesheetLockdownValidatorTest extends ConstraintValidatorTestCase
self::assertEmpty($this->context->getViolations());
}
/**
* @dataProvider getTestData
*/
#[DataProvider('getTestData')]
public function testLockdown(bool $allowOverwriteFull, bool $allowOverwriteGrace, string $beginModifier, string $nowModifier, bool $isViolation): void
{
$this->validator = $this->createMyValidator($allowOverwriteFull, $allowOverwriteGrace, 'first day of last month', 'last day of last month', '+10 days');
@@ -190,9 +190,7 @@ class TimesheetLockdownValidatorTest extends ConstraintValidatorTestCase
yield [true, true, '+5 days', '+11 days', false];
}
/**
* @dataProvider getConfigTestData
*/
#[DataProvider('getConfigTestData')]
public function testLockdownConfig(bool $allowOverwriteFull, bool $allowOverwriteGrace, ?string $lockdownBegin, ?string $lockdownEnd, ?string $grace, bool $isViolation): void
{
$this->validator = $this->createMyValidator($allowOverwriteFull, $allowOverwriteGrace, $lockdownBegin, $lockdownEnd, $grace);

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimesheetConstraint;
use App\Validator\Constraints\TimesheetLongRunning;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Validator\Constraints\TimesheetLongRunning
*/
#[CoversClass(TimesheetLongRunning::class)]
class TimesheetLongRunningTest extends TestCase
{
public function testIsTimesheetConstraint(): void

View File

@@ -14,15 +14,16 @@ use App\Entity\Timesheet;
use App\Tests\Mocks\SystemConfigurationFactory;
use App\Validator\Constraints\TimesheetLongRunning;
use App\Validator\Constraints\TimesheetLongRunningValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetLongRunning
* @covers \App\Validator\Constraints\TimesheetLongRunningValidator
* @extends ConstraintValidatorTestCase<TimesheetLongRunningValidator>
*/
#[CoversClass(TimesheetLongRunning::class)]
#[CoversClass(TimesheetLongRunningValidator::class)]
class TimesheetLongRunningValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetLongRunningValidator

View File

@@ -15,15 +15,16 @@ use App\Entity\Project;
use App\Form\MultiUpdate\TimesheetMultiUpdateDTO;
use App\Validator\Constraints\TimesheetMultiUpdate as TimesheetMultiUpdateConstraint;
use App\Validator\Constraints\TimesheetMultiUpdateValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetMultiUpdate
* @covers \App\Validator\Constraints\TimesheetMultiUpdateValidator
* @extends ConstraintValidatorTestCase<TimesheetMultiUpdateValidator>
*/
#[CoversClass(TimesheetMultiUpdateConstraint::class)]
#[CoversClass(TimesheetMultiUpdateValidator::class)]
class TimesheetMultiUpdateValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetMultiUpdateValidator

View File

@@ -12,15 +12,16 @@ namespace App\Tests\Validator\Constraints;
use App\Form\Model\MultiUserTimesheet;
use App\Validator\Constraints\TimesheetMultiUser;
use App\Validator\Constraints\TimesheetMultiUserValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetMultiUser
* @covers \App\Validator\Constraints\TimesheetMultiUserValidator
* @extends ConstraintValidatorTestCase<TimesheetMultiUserValidator>
*/
#[CoversClass(TimesheetMultiUser::class)]
#[CoversClass(TimesheetMultiUserValidator::class)]
class TimesheetMultiUserValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetMultiUserValidator

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimesheetConstraint;
use App\Validator\Constraints\TimesheetNegativeDuration;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Validator\Constraints\TimesheetNegativeDuration
*/
#[CoversClass(TimesheetNegativeDuration::class)]
class TimesheetNegativeDurationTest extends TestCase
{
public function testIsTimesheetConstraint(): void

View File

@@ -12,15 +12,16 @@ namespace App\Tests\Validator\Constraints;
use App\Entity\Timesheet;
use App\Validator\Constraints\TimesheetNegativeDuration;
use App\Validator\Constraints\TimesheetNegativeDurationValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetNegativeDuration
* @covers \App\Validator\Constraints\TimesheetNegativeDurationValidator
* @extends ConstraintValidatorTestCase<TimesheetNegativeDurationValidator>
*/
#[CoversClass(TimesheetNegativeDuration::class)]
#[CoversClass(TimesheetNegativeDurationValidator::class)]
class TimesheetNegativeDurationValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetNegativeDurationValidator

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimesheetConstraint;
use App\Validator\Constraints\TimesheetOverlapping;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Validator\Constraints\TimesheetOverlapping
*/
#[CoversClass(TimesheetOverlapping::class)]
class TimesheetOverlappingTest extends TestCase
{
public function testIsTimesheetConstraint(): void

View File

@@ -15,15 +15,16 @@ use App\Repository\TimesheetRepository;
use App\Tests\Mocks\SystemConfigurationFactory;
use App\Validator\Constraints\TimesheetOverlapping;
use App\Validator\Constraints\TimesheetOverlappingValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetOverlapping
* @covers \App\Validator\Constraints\TimesheetOverlappingValidator
* @extends ConstraintValidatorTestCase<TimesheetOverlappingValidator>
*/
#[CoversClass(TimesheetOverlapping::class)]
#[CoversClass(TimesheetOverlappingValidator::class)]
class TimesheetOverlappingValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetOverlappingValidator

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimesheetConstraint;
use App\Validator\Constraints\TimesheetRestart;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Validator\Constraints\TimesheetRestart
*/
#[CoversClass(TimesheetRestart::class)]
class TimesheetRestartTest extends TestCase
{
public function testIsTimesheetConstraint(): void

View File

@@ -18,16 +18,18 @@ use App\Tests\Mocks\TrackingModeServiceFactory;
use App\Validator\Constraints\TimesheetOverlapping;
use App\Validator\Constraints\TimesheetRestart;
use App\Validator\Constraints\TimesheetRestartValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetRestart
* @covers \App\Validator\Constraints\TimesheetRestartValidator
* @extends ConstraintValidatorTestCase<TimesheetRestartValidator>
*/
#[CoversClass(TimesheetRestart::class)]
#[CoversClass(TimesheetRestartValidator::class)]
class TimesheetRestartValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetRestartValidator
@@ -60,9 +62,7 @@ class TimesheetRestartValidatorTest extends ConstraintValidatorTestCase
$this->validator->validate(new NotBlank(), new TimesheetOverlapping(['message' => 'myMessage']));
}
/**
* @dataProvider getTestData
*/
#[DataProvider('getTestData')]
public function testRestartDisallowed(bool $allowed, ?string $property, string $trackingMode): void
{
$this->validator = $this->createMyValidator($allowed, $trackingMode);

View File

@@ -12,15 +12,16 @@ namespace App\Tests\Validator\Constraints;
use App\Entity\Timesheet;
use App\Validator\Constraints\Timesheet as TimesheetConstraint;
use App\Validator\Constraints\TimesheetValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\Timesheet
* @covers \App\Validator\Constraints\TimesheetValidator
* @extends ConstraintValidatorTestCase<TimesheetValidator>
*/
#[CoversClass(\App\Validator\Constraints\Timesheet::class)]
#[CoversClass(TimesheetValidator::class)]
class TimesheetValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetValidator

View File

@@ -11,11 +11,10 @@ namespace App\Tests\Validator\Constraints;
use App\Validator\Constraints\TimesheetConstraint;
use App\Validator\Constraints\TimesheetZeroDuration;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Validator\Constraints\TimesheetZeroDuration
*/
#[CoversClass(TimesheetZeroDuration::class)]
class TimesheetZeroDurationTest extends TestCase
{
public function testIsTimesheetConstraint(): void

View File

@@ -14,15 +14,16 @@ use App\Entity\Timesheet;
use App\Tests\Mocks\SystemConfigurationFactory;
use App\Validator\Constraints\TimesheetZeroDuration;
use App\Validator\Constraints\TimesheetZeroDurationValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\TimesheetZeroDuration
* @covers \App\Validator\Constraints\TimesheetZeroDurationValidator
* @extends ConstraintValidatorTestCase<TimesheetZeroDurationValidator>
*/
#[CoversClass(TimesheetZeroDuration::class)]
#[CoversClass(TimesheetZeroDurationValidator::class)]
class TimesheetZeroDurationValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): TimesheetZeroDurationValidator

View File

@@ -14,15 +14,16 @@ use App\Tests\Security\TestUserEntity;
use App\User\UserService;
use App\Validator\Constraints\User;
use App\Validator\Constraints\UserValidator;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
/**
* @covers \App\Validator\Constraints\User
* @covers \App\Validator\Constraints\UserValidator
* @extends ConstraintValidatorTestCase<UserValidator>
*/
#[CoversClass(\App\Validator\Constraints\User::class)]
#[CoversClass(UserValidator::class)]
class UserValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): UserValidator