Release 2.12 (#4609)

This commit is contained in:
Kevin Papst
2024-02-07 23:47:25 +01:00
committed by GitHub
parent 7abe787778
commit 85a16a9363
394 changed files with 1189 additions and 6735 deletions

View File

@@ -40,7 +40,7 @@ class ColorChoicesValidatorTest extends ConstraintValidatorTestCase
yield [null];
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
@@ -51,7 +51,7 @@ class ColorChoicesValidatorTest extends ConstraintValidatorTestCase
* @dataProvider getValidColors
* @param string $color
*/
public function testConstraintWithValidColor($color)
public function testConstraintWithValidColor($color): void
{
$constraint = new ColorChoices();
$this->validator->validate($color, $constraint);
@@ -84,7 +84,7 @@ class ColorChoicesValidatorTest extends ConstraintValidatorTestCase
* @param string|null $invalidName
* @param string|null $invalidNameCode
*/
public function testValidationError(string $color, $invalidColor = null, $invalidName = null, $invalidNameCode = null)
public function testValidationError(string $color, $invalidColor = null, $invalidName = null, $invalidNameCode = null): void
{
$constraint = new ColorChoices();

View File

@@ -39,7 +39,7 @@ class DateTimeFormatValidatorTest extends ConstraintValidatorTestCase
];
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
@@ -50,7 +50,7 @@ class DateTimeFormatValidatorTest extends ConstraintValidatorTestCase
* @dataProvider getValidData
* @param string $input
*/
public function testConstraintWithValidData($input)
public function testConstraintWithValidData($input): void
{
$constraint = new DateTimeFormat();
$this->validator->validate($input, $constraint);
@@ -72,7 +72,7 @@ class DateTimeFormatValidatorTest extends ConstraintValidatorTestCase
* @dataProvider getInvalidData
* @param mixed $input
*/
public function testValidationError($input)
public function testValidationError($input): void
{
$constraint = new DateTimeFormat();

View File

@@ -39,7 +39,7 @@ class HexColorValidatorTest extends ConstraintValidatorTestCase
yield [null];
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
@@ -50,7 +50,7 @@ class HexColorValidatorTest extends ConstraintValidatorTestCase
* @dataProvider getValidColors
* @param string $color
*/
public function testConstraintWithValidColor($color)
public function testConstraintWithValidColor($color): void
{
$constraint = new HexColor();
$this->validator->validate($color, $constraint);
@@ -79,7 +79,7 @@ class HexColorValidatorTest extends ConstraintValidatorTestCase
* @dataProvider getInvalidColors
* @param mixed $color
*/
public function testValidationError($color, $parameterType = null)
public function testValidationError($color, $parameterType = null): void
{
$constraint = new HexColor();

View File

@@ -28,14 +28,14 @@ class ProjectValidatorTest extends ConstraintValidatorTestCase
return new ProjectValidator();
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate('foo', new NotBlank());
}
public function testEndBeforeStartIsInvalid()
public function testEndBeforeStartIsInvalid(): void
{
$begin = new \DateTime();
$end = new \DateTime('-1 hour');
@@ -51,7 +51,7 @@ class ProjectValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testGetTargets()
public function testGetTargets(): void
{
$constraint = new ProjectConstraint();
self::assertEquals('class', $constraint->getTargets());

View File

@@ -31,21 +31,21 @@ class QuickEntryModelValidatorTest extends ConstraintValidatorTestCase
return new QuickEntryModelValidator();
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testInvalidValueThrowsException()
public function testInvalidValueThrowsException(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new QuickEntryModel());
}
public function testTriggersOnMissingProjectAndActivity()
public function testTriggersOnMissingProjectAndActivity(): void
{
$model = new QuickEntryModelEntity();
$timesheet = new Timesheet();
@@ -64,7 +64,7 @@ class QuickEntryModelValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testTriggersOnMissingActivity()
public function testTriggersOnMissingActivity(): void
{
$model = new QuickEntryModelEntity();
$model->setProject(new Project());
@@ -81,7 +81,7 @@ class QuickEntryModelValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testTriggersOnMissingProject()
public function testTriggersOnMissingProject(): void
{
$model = new QuickEntryModelEntity();
$model->setActivity(new Activity());
@@ -98,7 +98,7 @@ class QuickEntryModelValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testDoesNotTriggerOnPrototype()
public function testDoesNotTriggerOnPrototype(): void
{
$model = new QuickEntryModelEntity();
@@ -107,7 +107,7 @@ class QuickEntryModelValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testDoesNotTriggerOnProperlyFilled()
public function testDoesNotTriggerOnProperlyFilled(): void
{
$model = new QuickEntryModelEntity();
$model->setActivity(new Activity());

View File

@@ -36,21 +36,21 @@ class QuickEntryTimesheetValidatorTest extends ConstraintValidatorTestCase
return new QuickEntryTimesheetValidator([new TimesheetBasic()]);
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testInvalidValueThrowsException()
public function testInvalidValueThrowsException(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Activity(), $this->createConstraint());
}
public function testNotTriggersOnEmptyDurationAndNewTimesheet()
public function testNotTriggersOnEmptyDurationAndNewTimesheet(): void
{
$timesheet = new Timesheet();
$timesheet->setDuration(null);

View File

@@ -42,7 +42,7 @@ class RoleValidatorTest extends ConstraintValidatorTestCase
];
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
@@ -53,14 +53,14 @@ class RoleValidatorTest extends ConstraintValidatorTestCase
* @dataProvider getValidRoles
* @param string $role
*/
public function testConstraintWithValidRole($role)
public function testConstraintWithValidRole($role): void
{
$constraint = new Role();
$this->validator->validate($role, $constraint);
$this->assertNoViolation();
}
public function testNullIsInvalid()
public function testNullIsInvalid(): void
{
$this->validator->validate(null, new Role(['message' => 'myMessage']));
@@ -86,7 +86,7 @@ class RoleValidatorTest extends ConstraintValidatorTestCase
* @dataProvider getInvalidRoles
* @param mixed $role
*/
public function testValidationError($role)
public function testValidationError($role): void
{
$constraint = new Role([
'message' => 'myMessage',

View File

@@ -30,14 +30,14 @@ class TeamValidatorTest extends ConstraintValidatorTestCase
return new TeamValidator();
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate('foo', new NotBlank()); // @phpstan-ignore-line
}
public function testMissingTeamlead()
public function testMissingTeamlead(): void
{
$member = new TeamMember();
$member->setTeamlead(false);

View File

@@ -28,14 +28,14 @@ class TimeFormatValidatorTest extends ConstraintValidatorTestCase
return new TimeFormatValidator();
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate('foo', new NotBlank());
}
public function testWrongValueThrowsException()
public function testWrongValueThrowsException(): void
{
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Expected argument of type "string", "stdClass" given');
@@ -46,7 +46,7 @@ class TimeFormatValidatorTest extends ConstraintValidatorTestCase
/**
* @dataProvider getValidTimes
*/
public function testValidationSucceeds(?string $value)
public function testValidationSucceeds(?string $value): void
{
$this->validator->validate($value, new TimeFormat());
$this->assertNoViolation();
@@ -69,7 +69,7 @@ class TimeFormatValidatorTest extends ConstraintValidatorTestCase
/**
* @dataProvider getInvalidTimes
*/
public function testValidationProblem(?string $value)
public function testValidationProblem(?string $value): void
{
$this->validator->validate($value, new TimeFormat());

View File

@@ -39,21 +39,21 @@ class TimesheetBasicValidatorTest extends ConstraintValidatorTestCase
return new TimesheetBasicValidator($configuration);
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testInvalidValueThrowsException()
public function testInvalidValueThrowsException(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new NotBlank(), new TimesheetBasic(['message' => 'myMessage']));
}
public function testEmptyTimesheet()
public function testEmptyTimesheet(): void
{
$timesheet = new Timesheet();
$this->validator->validate($timesheet, new TimesheetBasic(['message' => 'myMessage']));
@@ -70,7 +70,7 @@ class TimesheetBasicValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testFutureBegin()
public function testFutureBegin(): void
{
$begin = new \DateTime('+10 hour');
$timesheet = new Timesheet();
@@ -95,7 +95,7 @@ class TimesheetBasicValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testEndBeforeBegin()
public function testEndBeforeBegin(): void
{
$end = new \DateTime('-10 hour');
$begin = new \DateTime('-1 hour');
@@ -117,7 +117,7 @@ class TimesheetBasicValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testProjectMismatch()
public function testProjectMismatch(): void
{
$end = new \DateTime('-1 hour');
$begin = new \DateTime('-10 hour');
@@ -172,7 +172,7 @@ class TimesheetBasicValidatorTest extends ConstraintValidatorTestCase
/**
* @dataProvider getProjectStartEndTestData
*/
public function testEndBeforeWithProjectStartAndEnd(\DateTime $start, \DateTime $end, array $violations)
public function testEndBeforeWithProjectStartAndEnd(\DateTime $start, \DateTime $end, array $violations): void
{
$timesheet = new Timesheet();
$timesheet->setBegin(new \DateTime('-10 hour'));
@@ -206,7 +206,7 @@ class TimesheetBasicValidatorTest extends ConstraintValidatorTestCase
$assertion->assertRaised();
}
public function testGetTargets()
public function testGetTargets(): void
{
$constraint = new TimesheetBasic();
self::assertEquals('class', $constraint->getTargets());

View File

@@ -100,14 +100,14 @@ class TimesheetBudgetUsedValidatorTest extends ConstraintValidatorTestCase
return new TimesheetBudgetUsedValidator($configuration, $customerRepository, $projectRepository, $activityRepository, $timesheetRepository, $rateService, $auth, $localeService);
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testConstraintWithPreExistingViolation()
public function testConstraintWithPreExistingViolation(): void
{
$this->validator = $this->createValidator();
$this->validator->initialize($this->context);
@@ -117,14 +117,14 @@ class TimesheetBudgetUsedValidatorTest extends ConstraintValidatorTestCase
$this->buildViolation('FOOOOOOOOO')->assertRaised();
}
public function testTargetIsInvalid()
public function testTargetIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate('foo', new TimesheetBudgetUsed()); // @phpstan-ignore-line
}
public function testWithMissingEnd()
public function testWithMissingEnd(): void
{
$timesheet = new Timesheet();
$timesheet->setBegin(new DateTime());
@@ -133,7 +133,7 @@ class TimesheetBudgetUsedValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testWithMissingUser()
public function testWithMissingUser(): void
{
$timesheet = new Timesheet();
$timesheet->setBegin(new DateTime());
@@ -143,7 +143,7 @@ class TimesheetBudgetUsedValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testWithMissingProject()
public function testWithMissingProject(): void
{
$timesheet = new Timesheet();
$timesheet->setBegin(new DateTime());
@@ -154,7 +154,7 @@ class TimesheetBudgetUsedValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testWithoutBudget()
public function testWithoutBudget(): void
{
$project = new Project();
$project->setCustomer(new Customer('foo'));
@@ -169,7 +169,7 @@ class TimesheetBudgetUsedValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testWithAllowedOverbooking()
public function testWithAllowedOverbooking(): void
{
$this->validator = $this->createValidator(true);
$this->validator->initialize($this->context);

View File

@@ -48,21 +48,21 @@ class TimesheetExportedValidatorTest extends ConstraintValidatorTestCase
return new TimesheetExportedValidator($auth);
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testInvalidValueThrowsException()
public function testInvalidValueThrowsException(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new NotBlank(), new TimesheetExported(['message' => 'myMessage'])); // @phpstan-ignore-line
}
public function testTriggersOnMissingPermission()
public function testTriggersOnMissingPermission(): void
{
$this->validator = $this->createMyValidator(false);
$this->validator->initialize($this->context);
@@ -79,7 +79,7 @@ class TimesheetExportedValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testNotTriggersOnNewTimesheet()
public function testNotTriggersOnNewTimesheet(): void
{
$this->validator = $this->createMyValidator(false);
$this->validator->initialize($this->context);
@@ -93,7 +93,7 @@ class TimesheetExportedValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testDoesNotTriggerWithPermission()
public function testDoesNotTriggerWithPermission(): void
{
$this->validator = $this->createMyValidator(true);
$this->validator->initialize($this->context);
@@ -106,7 +106,7 @@ class TimesheetExportedValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testDoesNotTriggerIfNotExported()
public function testDoesNotTriggerIfNotExported(): void
{
$this->validator = $this->createMyValidator(false);
$this->validator->initialize($this->context);
@@ -119,7 +119,7 @@ class TimesheetExportedValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testGetTargets()
public function testGetTargets(): void
{
$constraint = new TimesheetExported();
self::assertEquals('class', $constraint->getTargets());

View File

@@ -49,21 +49,21 @@ class TimesheetFutureTimesValidatorTest extends ConstraintValidatorTestCase
return new TimesheetFutureTimesValidator($config);
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testInvalidValueThrowsException()
public function testInvalidValueThrowsException(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new NotBlank(), new TimesheetFutureTimes(['message' => 'myMessage'])); // @phpstan-ignore-line
}
public function testFutureBeginIsDisallowed()
public function testFutureBeginIsDisallowed(): void
{
$begin = new \DateTime('+10 hour');
$timesheet = new Timesheet();
@@ -77,7 +77,7 @@ class TimesheetFutureTimesValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testFutureBeginIsAllowed()
public function testFutureBeginIsAllowed(): void
{
$this->validator = $this->createMyValidator(true);
$this->validator->initialize($this->context);

View File

@@ -64,21 +64,21 @@ class TimesheetLockdownValidatorTest extends ConstraintValidatorTestCase
return new TimesheetLockdownValidator($auth, new LockdownService($config));
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testInvalidValueThrowsException()
public function testInvalidValueThrowsException(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new NotBlank(), new TimesheetLockdown(['message' => 'myMessage'])); // @phpstan-ignore-line
}
public function testValidatorWithoutNowConstraint()
public function testValidatorWithoutNowConstraint(): void
{
$this->validator = $this->createMyValidator(false, false, 'first day of last month', 'last day of last month', '+10 days');
$this->validator->initialize($this->context);
@@ -98,7 +98,7 @@ class TimesheetLockdownValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testValidatorWithEmptyTimesheet()
public function testValidatorWithEmptyTimesheet(): void
{
$this->validator = $this->createMyValidator(false, false, 'first day of last month', 'last day of last month', '+10 days');
$this->validator->initialize($this->context);
@@ -109,7 +109,7 @@ class TimesheetLockdownValidatorTest extends ConstraintValidatorTestCase
self::assertEmpty($this->context->getViolations());
}
public function testValidatorWithoutNowStringConstraint()
public function testValidatorWithoutNowStringConstraint(): void
{
$this->validator = $this->createMyValidator(false, false, 'first day of last month', 'last day of last month', '+10 days');
$this->validator->initialize($this->context);
@@ -125,7 +125,7 @@ class TimesheetLockdownValidatorTest extends ConstraintValidatorTestCase
self::assertEmpty($this->context->getViolations());
}
public function testValidatorWithEndBeforeStartPeriod()
public function testValidatorWithEndBeforeStartPeriod(): void
{
$this->validator = $this->createMyValidator(false, false, 'first day of this month', 'last day of last month', '+10 days');
$this->validator->initialize($this->context);
@@ -144,7 +144,7 @@ class TimesheetLockdownValidatorTest extends ConstraintValidatorTestCase
/**
* @dataProvider getTestData
*/
public function testLockdown(bool $allowOverwriteFull, bool $allowOverwriteGrace, string $beginModifier, string $nowModifier, bool $isViolation)
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');
$this->validator->initialize($this->context);
@@ -193,7 +193,7 @@ class TimesheetLockdownValidatorTest extends ConstraintValidatorTestCase
/**
* @dataProvider getConfigTestData
*/
public function testLockdownConfig(bool $allowOverwriteFull, bool $allowOverwriteGrace, ?string $lockdownBegin, ?string $lockdownEnd, ?string $grace, bool $isViolation)
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);
$this->validator->initialize($this->context);

View File

@@ -44,21 +44,21 @@ class TimesheetLongRunningValidatorTest extends ConstraintValidatorTestCase
return new TimesheetLongRunningValidator($config);
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testInvalidValueThrowsException()
public function testInvalidValueThrowsException(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new NotBlank(), new TimesheetLongRunning(['message' => 'myMessage'])); // @phpstan-ignore-line
}
public function testLongRunningTriggers()
public function testLongRunningTriggers(): void
{
$begin = new \DateTime();
$end = new \DateTime('+10 hour');
@@ -75,7 +75,7 @@ class TimesheetLongRunningValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testLongRunningTriggersOverMaximum()
public function testLongRunningTriggersOverMaximum(): void
{
$begin = new \DateTime();
$end = clone $begin;
@@ -93,7 +93,7 @@ class TimesheetLongRunningValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testLongRunningDoesNotTriggerOnMaximum()
public function testLongRunningDoesNotTriggerOnMaximum(): void
{
$timesheet = new Timesheet();
$timesheet->setBegin(new \DateTime());
@@ -105,7 +105,7 @@ class TimesheetLongRunningValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testLongRunningNotTriggersIfConfiguredToZero()
public function testLongRunningNotTriggersIfConfiguredToZero(): void
{
$this->validator = $this->createMyValidator(0);
$this->validator->initialize($this->context);
@@ -121,7 +121,7 @@ class TimesheetLongRunningValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testLongRunningNotTriggersIfDurationIsLowerThan()
public function testLongRunningNotTriggersIfDurationIsLowerThan(): void
{
$this->validator = $this->createMyValidator(121);
$this->validator->initialize($this->context);
@@ -137,7 +137,7 @@ class TimesheetLongRunningValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testNotTriggersOnRunningRecord()
public function testNotTriggersOnRunningRecord(): void
{
$begin = new \DateTime('-10 hour');
$timesheet = new Timesheet();
@@ -147,7 +147,7 @@ class TimesheetLongRunningValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testGetTargets()
public function testGetTargets(): void
{
$constraint = new TimesheetLongRunning();
self::assertEquals('class', $constraint->getTargets());

View File

@@ -31,14 +31,14 @@ class TimesheetMultiUpdateValidatorTest extends ConstraintValidatorTestCase
return new TimesheetMultiUpdateValidator();
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate('foo', new NotBlank());
}
public function testProjectMismatch()
public function testProjectMismatch(): void
{
$activity = new Activity();
$project1 = new Project();
@@ -57,7 +57,7 @@ class TimesheetMultiUpdateValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testProjectWithoutActivity()
public function testProjectWithoutActivity(): void
{
$timesheet = new TimesheetMultiUpdateDTO();
$timesheet
@@ -72,7 +72,7 @@ class TimesheetMultiUpdateValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testActivityWithoutProject()
public function testActivityWithoutProject(): void
{
$timesheet = new TimesheetMultiUpdateDTO();
$timesheet
@@ -87,7 +87,7 @@ class TimesheetMultiUpdateValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testHourlyRateAndFixedRateInParallelAreNotAllowed()
public function testHourlyRateAndFixedRateInParallelAreNotAllowed(): void
{
$timesheet = new TimesheetMultiUpdateDTO();
$timesheet->setHourlyRate(10.12);
@@ -104,7 +104,7 @@ class TimesheetMultiUpdateValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testDisabledValues()
public function testDisabledValues(): void
{
$customer = new Customer('foo');
$customer->setVisible(false);

View File

@@ -28,14 +28,14 @@ class TimesheetMultiUserValidatorTest extends ConstraintValidatorTestCase
return new TimesheetMultiUserValidator();
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate('foo', new NotBlank());
}
public function testEmptyTimesheet()
public function testEmptyTimesheet(): void
{
$timesheet = new MultiUserTimesheet();

View File

@@ -47,21 +47,21 @@ class TimesheetOverlappingValidatorTest extends ConstraintValidatorTestCase
return new TimesheetOverlappingValidator($config, $repository);
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testInvalidValueThrowsException()
public function testInvalidValueThrowsException(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new NotBlank(), new TimesheetOverlapping(['message' => 'myMessage'])); // @phpstan-ignore-line
}
public function testOverlappingDisallowedWithRecords()
public function testOverlappingDisallowedWithRecords(): void
{
$begin = new \DateTime();
$end = new \DateTime('+10 hour');
@@ -77,7 +77,7 @@ class TimesheetOverlappingValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testOverlappingDisallowedWithoutRecords()
public function testOverlappingDisallowedWithoutRecords(): void
{
$this->validator = $this->createMyValidator(false, false);
$this->validator->initialize($this->context);
@@ -92,7 +92,7 @@ class TimesheetOverlappingValidatorTest extends ConstraintValidatorTestCase
self::assertEmpty($this->context->getViolations());
}
public function testOverlappingAllowedWithRecords()
public function testOverlappingAllowedWithRecords(): void
{
$this->validator = $this->createMyValidator(true, true);
$this->validator->initialize($this->context);
@@ -107,7 +107,7 @@ class TimesheetOverlappingValidatorTest extends ConstraintValidatorTestCase
self::assertEmpty($this->context->getViolations());
}
public function testOverlappingAllowedWithoutRecords()
public function testOverlappingAllowedWithoutRecords(): void
{
$this->validator = $this->createMyValidator(true, false);
$this->validator->initialize($this->context);

View File

@@ -46,14 +46,14 @@ class TimesheetRestartValidatorTest extends ConstraintValidatorTestCase
return new TimesheetRestartValidator($auth, $service);
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testInvalidValueThrowsException()
public function testInvalidValueThrowsException(): void
{
$this->expectException(UnexpectedTypeException::class);
@@ -63,7 +63,7 @@ class TimesheetRestartValidatorTest extends ConstraintValidatorTestCase
/**
* @dataProvider getTestData
*/
public function testRestartDisallowed(bool $allowed, ?string $property, string $trackingMode)
public function testRestartDisallowed(bool $allowed, ?string $property, string $trackingMode): void
{
$this->validator = $this->createMyValidator($allowed, $trackingMode);
$this->validator->initialize($this->context);

View File

@@ -33,14 +33,14 @@ class TimesheetValidatorTest extends ConstraintValidatorTestCase
return new TimesheetValidator([]);
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testInvalidValueThrowsException()
public function testInvalidValueThrowsException(): void
{
$this->expectException(UnexpectedTypeException::class);

View File

@@ -44,14 +44,14 @@ class TimesheetZeroDurationValidatorTest extends ConstraintValidatorTestCase
return new TimesheetZeroDurationValidator($config);
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate(new Timesheet(), new NotBlank());
}
public function testInvalidValueThrowsException()
public function testInvalidValueThrowsException(): void
{
$this->expectException(UnexpectedTypeException::class);
@@ -70,7 +70,7 @@ class TimesheetZeroDurationValidatorTest extends ConstraintValidatorTestCase
return $timesheet;
}
public function testZeroDurationIsDisallowed()
public function testZeroDurationIsDisallowed(): void
{
$timesheet = $this->prepareTimesheet();
@@ -82,7 +82,7 @@ class TimesheetZeroDurationValidatorTest extends ConstraintValidatorTestCase
->assertRaised();
}
public function testZeroDurationIsAllowed()
public function testZeroDurationIsAllowed(): void
{
$this->validator = $this->createMyValidator(true);
$this->validator->initialize($this->context);

View File

@@ -32,28 +32,28 @@ class UserValidatorTest extends ConstraintValidatorTestCase
return new UserValidator($userService);
}
public function testConstraintIsInvalid()
public function testConstraintIsInvalid(): void
{
$this->expectException(UnexpectedTypeException::class);
$this->validator->validate('foo', new NotBlank()); // @phpstan-ignore-line
}
public function testNullIsValid()
public function testNullIsValid(): void
{
$this->validator->validate(null, new User(['message' => 'myMessage'])); // @phpstan-ignore-line
$this->assertNoViolation();
}
public function testNonUserIsValid()
public function testNonUserIsValid(): void
{
$this->validator->validate(new TestUserEntity(), new User(['message' => 'myMessage'])); // @phpstan-ignore-line
$this->assertNoViolation();
}
public function testEmptyUserIsValid()
public function testEmptyUserIsValid(): void
{
$user = new UserEntity();
$user->setUserIdentifier('foo');
@@ -63,7 +63,7 @@ class UserValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testUserIsValidWithEmptyRepository()
public function testUserIsValidWithEmptyRepository(): void
{
$user = new UserEntity();
$user->setUserIdentifier('foo');
@@ -74,7 +74,7 @@ class UserValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation();
}
public function testUserIsInvalidWithRepository()
public function testUserIsInvalidWithRepository(): void
{
$existing = $this->createMock(UserEntity::class);
$existing->expects($this->exactly(4))->method('getId')->willReturn(123);