Release 2.12 (#4609)
This commit is contained in:
@@ -24,7 +24,7 @@ class BillableCalculatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTestData
|
||||
*/
|
||||
public function testCalculate(bool $billable, string $mode, bool $expected, ?Customer $customer, ?Project $project, ?Activity $activity)
|
||||
public function testCalculate(bool $billable, string $mode, bool $expected, ?Customer $customer, ?Project $project, ?Activity $activity): void
|
||||
{
|
||||
$sut = new BillableCalculator();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
class DurationCalculatorTest extends TestCase
|
||||
{
|
||||
public function testCalculateWithEmptyEnd()
|
||||
public function testCalculateWithEmptyEnd(): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setBegin(new \DateTime());
|
||||
@@ -34,7 +34,7 @@ class DurationCalculatorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTestData
|
||||
*/
|
||||
public function testCalculate($rules, $start, $end, $expectedDuration)
|
||||
public function testCalculate($rules, $start, $end, $expectedDuration): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setBegin($start);
|
||||
|
||||
@@ -38,7 +38,7 @@ class RateCalculatorTest extends TestCase
|
||||
return $mock;
|
||||
}
|
||||
|
||||
public function testCalculateWithTimesheetHourlyRate()
|
||||
public function testCalculateWithTimesheetHourlyRate(): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setEnd(new \DateTime());
|
||||
@@ -52,7 +52,7 @@ class RateCalculatorTest extends TestCase
|
||||
$this->assertEquals(50, $record->getRate());
|
||||
}
|
||||
|
||||
public function testCalculateWithTimesheetFixedRate()
|
||||
public function testCalculateWithTimesheetFixedRate(): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setEnd(new \DateTime());
|
||||
@@ -192,7 +192,7 @@ class RateCalculatorTest extends TestCase
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function testCalculateWithEmptyEnd()
|
||||
public function testCalculateWithEmptyEnd(): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setBegin(new \DateTime());
|
||||
@@ -213,7 +213,7 @@ class RateCalculatorTest extends TestCase
|
||||
*
|
||||
* @dataProvider getRuleDefinitions
|
||||
*/
|
||||
public function testCalculateWithRulesByUsersHourlyRate($duration, $rules, $expectedRate)
|
||||
public function testCalculateWithRulesByUsersHourlyRate($duration, $rules, $expectedRate): void
|
||||
{
|
||||
$end = new \DateTime('12:00:00', new \DateTimeZone('UTC'));
|
||||
$start = clone $end;
|
||||
|
||||
@@ -30,19 +30,19 @@ class DateTimeFactoryTest extends TestCase
|
||||
return new DateTimeFactory(new DateTimeZone($timezone), $sunday);
|
||||
}
|
||||
|
||||
public function testGetTimezone()
|
||||
public function testGetTimezone(): void
|
||||
{
|
||||
$sut = $this->createDateTimeFactory(self::TEST_TIMEZONE);
|
||||
$this->assertEquals(self::TEST_TIMEZONE, $sut->getTimezone()->getName());
|
||||
}
|
||||
|
||||
public function testGetTimezoneWithFallbackTimezone()
|
||||
public function testGetTimezoneWithFallbackTimezone(): void
|
||||
{
|
||||
$sut = $this->createDateTimeFactory();
|
||||
$this->assertEquals(date_default_timezone_get(), $sut->getTimezone()->getName());
|
||||
}
|
||||
|
||||
public function testGetStartOfMonth()
|
||||
public function testGetStartOfMonth(): void
|
||||
{
|
||||
$expected = new DateTime('now', new DateTimeZone(self::TEST_TIMEZONE));
|
||||
|
||||
@@ -57,7 +57,7 @@ class DateTimeFactoryTest extends TestCase
|
||||
$this->assertEquals(self::TEST_TIMEZONE, $dateTime->getTimezone()->getName());
|
||||
}
|
||||
|
||||
public function testGetEndOfMonth()
|
||||
public function testGetEndOfMonth(): void
|
||||
{
|
||||
$expected = new DateTime('last day of this month', new DateTimeZone(self::TEST_TIMEZONE));
|
||||
|
||||
@@ -82,7 +82,7 @@ class DateTimeFactoryTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getStartOfWeekData
|
||||
*/
|
||||
public function testGetStartOfWeek(DateTimeFactory $sut, string $dayName, int $dayNum, int $day)
|
||||
public function testGetStartOfWeek(DateTimeFactory $sut, string $dayName, int $dayNum, int $day): void
|
||||
{
|
||||
$expected = new DateTime('2018-07-26 16:47:31', new DateTimeZone(self::TEST_TIMEZONE));
|
||||
|
||||
@@ -119,7 +119,7 @@ class DateTimeFactoryTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getEndOfWeekData
|
||||
*/
|
||||
public function testGetEndOfWeek(DateTimeFactory $sut, string $dayName, int $dayNum, int $day)
|
||||
public function testGetEndOfWeek(DateTimeFactory $sut, string $dayName, int $dayNum, int $day): void
|
||||
{
|
||||
$expected = new DateTime('2018-07-26 16:47:31', new DateTimeZone(self::TEST_TIMEZONE));
|
||||
|
||||
@@ -146,7 +146,7 @@ class DateTimeFactoryTest extends TestCase
|
||||
$this->assertEquals(self::TEST_TIMEZONE, $dateTime->getTimezone()->getName());
|
||||
}
|
||||
|
||||
public function testCreateDateTime()
|
||||
public function testCreateDateTime(): void
|
||||
{
|
||||
$sut = $this->createDateTimeFactory(self::TEST_TIMEZONE);
|
||||
$dateTime = $sut->createDateTime('2015-07-24 13:45:21');
|
||||
@@ -159,7 +159,7 @@ class DateTimeFactoryTest extends TestCase
|
||||
$this->assertEquals(self::TEST_TIMEZONE, $dateTime->getTimezone()->getName());
|
||||
}
|
||||
|
||||
public function testCreateDateTimeWithDefaultValue()
|
||||
public function testCreateDateTimeWithDefaultValue(): void
|
||||
{
|
||||
$expected = new DateTime('now', new DateTimeZone(self::TEST_TIMEZONE));
|
||||
|
||||
@@ -170,7 +170,7 @@ class DateTimeFactoryTest extends TestCase
|
||||
$this->assertTrue(2 >= $difference);
|
||||
}
|
||||
|
||||
public function testCreateStartOfFinancialYearWithoutConfig()
|
||||
public function testCreateStartOfFinancialYearWithoutConfig(): void
|
||||
{
|
||||
$sut = $this->createDateTimeFactory(self::TEST_TIMEZONE);
|
||||
$dateTime = $sut->createStartOfFinancialYear();
|
||||
@@ -179,7 +179,7 @@ class DateTimeFactoryTest extends TestCase
|
||||
self::assertEquals($expected, $dateTime);
|
||||
}
|
||||
|
||||
public function testCreateStartOfFinancialYearWithConfig()
|
||||
public function testCreateStartOfFinancialYearWithConfig(): void
|
||||
{
|
||||
$sut = $this->createDateTimeFactory(self::TEST_TIMEZONE);
|
||||
|
||||
@@ -199,7 +199,7 @@ class DateTimeFactoryTest extends TestCase
|
||||
self::assertEquals($past, $financial);
|
||||
}
|
||||
|
||||
public function testCreateEndOfFinancialYearWithConfig()
|
||||
public function testCreateEndOfFinancialYearWithConfig(): void
|
||||
{
|
||||
$sut = $this->createDateTimeFactory(self::TEST_TIMEZONE);
|
||||
|
||||
@@ -218,7 +218,7 @@ class DateTimeFactoryTest extends TestCase
|
||||
self::assertEquals($expected, $end);
|
||||
}
|
||||
|
||||
public function testCreateStartOfYear()
|
||||
public function testCreateStartOfYear(): void
|
||||
{
|
||||
$sut = $this->createDateTimeFactory(self::TEST_TIMEZONE);
|
||||
|
||||
@@ -239,7 +239,7 @@ class DateTimeFactoryTest extends TestCase
|
||||
self::assertEquals('00:00:00', $year->format('H:i:s'));
|
||||
}
|
||||
|
||||
public function testCreateEndOfYear()
|
||||
public function testCreateEndOfYear(): void
|
||||
{
|
||||
$sut = $this->createDateTimeFactory(self::TEST_TIMEZONE);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class RateServiceTest extends TestCase
|
||||
return new \DateTime($datetime ?? 'now', new \DateTimeZone('UTC'));
|
||||
}
|
||||
|
||||
public function testCalculateWithTimesheetHourlyRate()
|
||||
public function testCalculateWithTimesheetHourlyRate(): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setEnd($this->createDateTime());
|
||||
@@ -56,7 +56,7 @@ class RateServiceTest extends TestCase
|
||||
$this->assertEquals(50, $rate->getRate());
|
||||
}
|
||||
|
||||
public function testCalculateWithTimesheetFixedRate()
|
||||
public function testCalculateWithTimesheetFixedRate(): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setEnd($this->createDateTime());
|
||||
@@ -196,7 +196,7 @@ class RateServiceTest extends TestCase
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function testCalculateWithEmptyEnd()
|
||||
public function testCalculateWithEmptyEnd(): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setBegin($this->createDateTime());
|
||||
@@ -217,7 +217,7 @@ class RateServiceTest extends TestCase
|
||||
*
|
||||
* @dataProvider getRuleDefinitions
|
||||
*/
|
||||
public function testCalculateWithRulesByUsersHourlyRate($duration, $rules, $expectedRate)
|
||||
public function testCalculateWithRulesByUsersHourlyRate($duration, $rules, $expectedRate): void
|
||||
{
|
||||
$end = $this->createDateTime('12:00:00');
|
||||
$start = clone $end;
|
||||
|
||||
@@ -21,7 +21,7 @@ class CeilRoundingTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTestData
|
||||
*/
|
||||
public function testCalculate($roundBegin, $roundEnd, $roundDuration, \DateTime $start, \DateTime $end, \DateTime $expectedStart, \DateTime $expectedEnd, $expectedDuration)
|
||||
public function testCalculate($roundBegin, $roundEnd, $roundDuration, \DateTime $start, \DateTime $end, \DateTime $expectedStart, \DateTime $expectedEnd, $expectedDuration): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setBegin($start);
|
||||
|
||||
@@ -21,7 +21,7 @@ class ClosestRoundingTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTestData
|
||||
*/
|
||||
public function testCalculate($roundBegin, $roundEnd, $roundDuration, \DateTime $start, \DateTime $end, \DateTime $expectedStart, \DateTime $expectedEnd, $expectedDuration)
|
||||
public function testCalculate($roundBegin, $roundEnd, $roundDuration, \DateTime $start, \DateTime $end, \DateTime $expectedStart, \DateTime $expectedEnd, $expectedDuration): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setBegin($start);
|
||||
|
||||
@@ -21,7 +21,7 @@ class DefaultRoundingTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTestData
|
||||
*/
|
||||
public function testCalculate($roundBegin, $roundEnd, $roundDuration, \DateTime $start, \DateTime $end, \DateTime $expectedStart, \DateTime $expectedEnd, $expectedDuration)
|
||||
public function testCalculate($roundBegin, $roundEnd, $roundDuration, \DateTime $start, \DateTime $end, \DateTime $expectedStart, \DateTime $expectedEnd, $expectedDuration): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setBegin($start);
|
||||
|
||||
@@ -21,7 +21,7 @@ class FloorRoundingTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTestData
|
||||
*/
|
||||
public function testCalculate($roundBegin, $roundEnd, $roundDuration, \DateTime $start, \DateTime $end, \DateTime $expectedStart, \DateTime $expectedEnd, $expectedDuration)
|
||||
public function testCalculate($roundBegin, $roundEnd, $roundDuration, \DateTime $start, \DateTime $end, \DateTime $expectedStart, \DateTime $expectedEnd, $expectedDuration): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setBegin($start);
|
||||
|
||||
@@ -18,7 +18,7 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
class RoundingServiceTest extends TestCase
|
||||
{
|
||||
public function testCalculateWithEmptyEnd()
|
||||
public function testCalculateWithEmptyEnd(): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setBegin(new \DateTime());
|
||||
@@ -32,7 +32,7 @@ class RoundingServiceTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTestData
|
||||
*/
|
||||
public function testCalculate($rules, $start, $end, $expectedStart, $expectedEnd, $expectedDuration)
|
||||
public function testCalculate($rules, $start, $end, $expectedStart, $expectedEnd, $expectedDuration): void
|
||||
{
|
||||
$record = new Timesheet();
|
||||
$record->setBegin($start);
|
||||
|
||||
@@ -65,7 +65,7 @@ class TimesheetServiceTest extends TestCase
|
||||
return $service;
|
||||
}
|
||||
|
||||
public function testCannotSavePersistedTimesheetAsNew()
|
||||
public function testCannotSavePersistedTimesheetAsNew(): void
|
||||
{
|
||||
$timesheet = $this->createMock(Timesheet::class);
|
||||
$timesheet->expects($this->once())->method('getId')->willReturn(1);
|
||||
@@ -78,7 +78,7 @@ class TimesheetServiceTest extends TestCase
|
||||
$sut->saveNewTimesheet($timesheet);
|
||||
}
|
||||
|
||||
public function testCannotStartTimesheet()
|
||||
public function testCannotStartTimesheet(): void
|
||||
{
|
||||
$authorizationChecker = $this->createMock(AuthorizationCheckerInterface::class);
|
||||
$authorizationChecker->expects($this->once())->method('isGranted')->willReturn(false);
|
||||
@@ -91,7 +91,7 @@ class TimesheetServiceTest extends TestCase
|
||||
$sut->saveNewTimesheet(new Timesheet());
|
||||
}
|
||||
|
||||
public function testSaveNewTimesheetHasValidationError()
|
||||
public function testSaveNewTimesheetHasValidationError(): void
|
||||
{
|
||||
$authorizationChecker = $this->createMock(AuthorizationCheckerInterface::class);
|
||||
$authorizationChecker->expects($this->once())->method('isGranted')->willReturn(true);
|
||||
@@ -110,7 +110,7 @@ class TimesheetServiceTest extends TestCase
|
||||
$sut->saveNewTimesheet(new Timesheet());
|
||||
}
|
||||
|
||||
public function testSaveNewTimesheetStopsActiveRecords()
|
||||
public function testSaveNewTimesheetStopsActiveRecords(): void
|
||||
{
|
||||
$authorizationChecker = $this->createMock(AuthorizationCheckerInterface::class);
|
||||
$authorizationChecker->expects($this->once())->method('isGranted')->willReturn(true);
|
||||
@@ -137,7 +137,7 @@ class TimesheetServiceTest extends TestCase
|
||||
$sut->saveNewTimesheet($newTimesheet);
|
||||
}
|
||||
|
||||
public function testSaveNewTimesheetFixesTimezone()
|
||||
public function testSaveNewTimesheetFixesTimezone(): void
|
||||
{
|
||||
$user = new User();
|
||||
$user->setTimezone('Europe/Paris');
|
||||
@@ -160,7 +160,7 @@ class TimesheetServiceTest extends TestCase
|
||||
self::assertEquals('Europe/Paris', $timesheet->getTimezone());
|
||||
}
|
||||
|
||||
public function testUpdateTimesheetFixesTimezone()
|
||||
public function testUpdateTimesheetFixesTimezone(): void
|
||||
{
|
||||
$user = new User();
|
||||
$user->setTimezone('Europe/Paris');
|
||||
@@ -181,7 +181,7 @@ class TimesheetServiceTest extends TestCase
|
||||
self::assertEquals('Europe/Paris', $timesheet->getTimezone());
|
||||
}
|
||||
|
||||
public function testCannotRestartedPersistedTimesheet()
|
||||
public function testCannotRestartedPersistedTimesheet(): void
|
||||
{
|
||||
$timesheet = $this->createMock(Timesheet::class);
|
||||
$timesheet->expects($this->once())->method('getId')->willReturn(1);
|
||||
@@ -201,7 +201,7 @@ class TimesheetServiceTest extends TestCase
|
||||
$sut->restartTimesheet($timesheet, new Timesheet());
|
||||
}
|
||||
|
||||
public function testRestartTimesheetDispatchesTwoEvents()
|
||||
public function testRestartTimesheetDispatchesTwoEvents(): void
|
||||
{
|
||||
$timesheet = $this->createMock(Timesheet::class);
|
||||
$authorizationChecker = $this->createMock(AuthorizationCheckerInterface::class);
|
||||
@@ -233,7 +233,7 @@ class TimesheetServiceTest extends TestCase
|
||||
$sut->restartTimesheet($timesheet, new Timesheet());
|
||||
}
|
||||
|
||||
public function testPreparePersistedTimesheetAsNew()
|
||||
public function testPreparePersistedTimesheetAsNew(): void
|
||||
{
|
||||
$timesheet = $this->createMock(Timesheet::class);
|
||||
$timesheet->expects($this->once())->method('getId')->willReturn(1);
|
||||
@@ -246,7 +246,7 @@ class TimesheetServiceTest extends TestCase
|
||||
$sut->prepareNewTimesheet($timesheet);
|
||||
}
|
||||
|
||||
public function testStoppedEntriesCannotBeStoppedAgain()
|
||||
public function testStoppedEntriesCannotBeStoppedAgain(): void
|
||||
{
|
||||
$dateTime = new \DateTime('-2 hours');
|
||||
$timesheet = new Timesheet();
|
||||
@@ -259,7 +259,7 @@ class TimesheetServiceTest extends TestCase
|
||||
self::assertSame($dateTime->getTimestamp(), $timesheet->getEnd()->getTimestamp());
|
||||
}
|
||||
|
||||
public function testStopSetsEnd()
|
||||
public function testStopSetsEnd(): void
|
||||
{
|
||||
$dateTime = new \DateTime('-2 hours');
|
||||
$timesheet = new Timesheet();
|
||||
@@ -273,7 +273,7 @@ class TimesheetServiceTest extends TestCase
|
||||
self::assertNotNull($timesheet->getEnd());
|
||||
}
|
||||
|
||||
public function testDeleteDispatchesEvent()
|
||||
public function testDeleteDispatchesEvent(): void
|
||||
{
|
||||
$timesheet = new Timesheet();
|
||||
|
||||
@@ -291,7 +291,7 @@ class TimesheetServiceTest extends TestCase
|
||||
$sut->deleteTimesheet($timesheet);
|
||||
}
|
||||
|
||||
public function testDeleteMultipleDispatchesEvent()
|
||||
public function testDeleteMultipleDispatchesEvent(): void
|
||||
{
|
||||
$timesheets = [new Timesheet(), new Timesheet()];
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ abstract class AbstractTrackingModeTest extends TestCase
|
||||
return $timesheet;
|
||||
}
|
||||
|
||||
protected function assertDefaultBegin(Timesheet $timesheet)
|
||||
public function assertDefaultBegin(Timesheet $timesheet): void
|
||||
{
|
||||
self::assertNull($timesheet->getBegin());
|
||||
}
|
||||
|
||||
public function testCreateDoesNotChangeAnythingOnEmptyRequest()
|
||||
public function testCreateDoesNotChangeAnythingOnEmptyRequest(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
@@ -53,7 +53,7 @@ abstract class AbstractTrackingModeTest extends TestCase
|
||||
self::assertNull($timesheet->getEnd());
|
||||
}
|
||||
|
||||
public function testCreateUseBeginWithoutEndDateFromRequest()
|
||||
public function testCreateUseBeginWithoutEndDateFromRequest(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
@@ -70,7 +70,7 @@ abstract class AbstractTrackingModeTest extends TestCase
|
||||
self::assertEquals(0, $timesheet->getDuration());
|
||||
}
|
||||
|
||||
public function testCreateUseBeginEndDateFromRequest()
|
||||
public function testCreateUseBeginEndDateFromRequest(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
@@ -90,7 +90,7 @@ abstract class AbstractTrackingModeTest extends TestCase
|
||||
self::assertEquals(28800, $timesheet->getDuration());
|
||||
}
|
||||
|
||||
public function testCreateIgnoresValidEndOnInvalidBeginDateFromRequest()
|
||||
public function testCreateIgnoresValidEndOnInvalidBeginDateFromRequest(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
@@ -107,7 +107,7 @@ abstract class AbstractTrackingModeTest extends TestCase
|
||||
self::assertEquals(0, $timesheet->getDuration());
|
||||
}
|
||||
|
||||
public function testCreateUsesBeginAndIgnoresInvalidEndDateFromRequest()
|
||||
public function testCreateUsesBeginAndIgnoresInvalidEndDateFromRequest(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
@@ -125,7 +125,7 @@ abstract class AbstractTrackingModeTest extends TestCase
|
||||
self::assertEquals(0, $timesheet->getDuration());
|
||||
}
|
||||
|
||||
public function testCreateUseFromWithoutToDatetimeFromRequest()
|
||||
public function testCreateUseFromWithoutToDatetimeFromRequest(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
@@ -141,7 +141,7 @@ abstract class AbstractTrackingModeTest extends TestCase
|
||||
self::assertEquals(0, $timesheet->getDuration());
|
||||
}
|
||||
|
||||
public function testCreateUseFromToDatetimeFromRequest()
|
||||
public function testCreateUseFromToDatetimeFromRequest(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
@@ -161,7 +161,7 @@ abstract class AbstractTrackingModeTest extends TestCase
|
||||
self::assertEquals(12196, $timesheet->getDuration());
|
||||
}
|
||||
|
||||
public function testCreateUseFromToDatetimeOverwritesBeginEndTatesFromRequest()
|
||||
public function testCreateUseFromToDatetimeOverwritesBeginEndTatesFromRequest(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
@@ -183,7 +183,7 @@ abstract class AbstractTrackingModeTest extends TestCase
|
||||
self::assertEquals(12196, $timesheet->getDuration());
|
||||
}
|
||||
|
||||
public function testCreateIgnoresValidToOnInvalidFromDatetimeFromRequest()
|
||||
public function testCreateIgnoresValidToOnInvalidFromDatetimeFromRequest(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
@@ -200,7 +200,7 @@ abstract class AbstractTrackingModeTest extends TestCase
|
||||
self::assertEquals(0, $timesheet->getDuration());
|
||||
}
|
||||
|
||||
public function testCreateUsesFromAndIgnoresInvalidToDatetimeFromRequest()
|
||||
public function testCreateUsesFromAndIgnoresInvalidToDatetimeFromRequest(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ use App\Timesheet\TrackingMode\DefaultMode;
|
||||
*/
|
||||
class DefaultModeTest extends AbstractTrackingModeTest
|
||||
{
|
||||
protected function assertDefaultBegin(Timesheet $timesheet)
|
||||
public function assertDefaultBegin(Timesheet $timesheet): void
|
||||
{
|
||||
self::assertNotNull($timesheet->getBegin());
|
||||
self::assertInstanceOf(\DateTime::class, $timesheet->getBegin());
|
||||
@@ -32,7 +32,7 @@ class DefaultModeTest extends AbstractTrackingModeTest
|
||||
return new DefaultMode((new RoundingServiceFactory($this))->create());
|
||||
}
|
||||
|
||||
public function testDefaultValues()
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class DurationFixedBeginModeTest extends TestCase
|
||||
return new DurationFixedBeginMode($configuration);
|
||||
}
|
||||
|
||||
public function testDefaultValues()
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
@@ -42,7 +42,7 @@ class DurationFixedBeginModeTest extends TestCase
|
||||
self::assertEquals('duration_fixed_begin', $sut->getId());
|
||||
}
|
||||
|
||||
public function testNow()
|
||||
public function testNow(): void
|
||||
{
|
||||
$seconds = (new \DateTime())->getTimestamp();
|
||||
$timesheet = new Timesheet();
|
||||
@@ -54,7 +54,7 @@ class DurationFixedBeginModeTest extends TestCase
|
||||
self::assertLessThanOrEqual(2, $diff);
|
||||
}
|
||||
|
||||
public function testCreate()
|
||||
public function testCreate(): void
|
||||
{
|
||||
$timesheet = new Timesheet();
|
||||
$timesheet->setBegin(new \DateTime('22:54'));
|
||||
@@ -66,7 +66,7 @@ class DurationFixedBeginModeTest extends TestCase
|
||||
self::assertEquals('13:47', $timesheet->getBegin()->format('H:i'));
|
||||
}
|
||||
|
||||
public function testCreateWithoutBeginInjectsBegin()
|
||||
public function testCreateWithoutBeginInjectsBegin(): void
|
||||
{
|
||||
$timesheet = (new Timesheet())->setUser(new User());
|
||||
$request = new Request();
|
||||
|
||||
@@ -20,7 +20,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
*/
|
||||
class PunchInOutModeTest extends TestCase
|
||||
{
|
||||
public function testDefaultValues()
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
$sut = new PunchInOutMode();
|
||||
|
||||
@@ -32,7 +32,7 @@ class PunchInOutModeTest extends TestCase
|
||||
self::assertEquals('punch', $sut->getId());
|
||||
}
|
||||
|
||||
public function testCreate()
|
||||
public function testCreate(): void
|
||||
{
|
||||
$startingTime = new \DateTime('22:54');
|
||||
$timesheet = new Timesheet();
|
||||
@@ -44,7 +44,7 @@ class PunchInOutModeTest extends TestCase
|
||||
self::assertEquals($timesheet->getBegin(), $startingTime);
|
||||
}
|
||||
|
||||
public function testCreateWithoutBegin()
|
||||
public function testCreateWithoutBegin(): void
|
||||
{
|
||||
$timesheet = (new Timesheet())->setUser(new User());
|
||||
$request = new Request();
|
||||
|
||||
@@ -19,7 +19,7 @@ use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||
*/
|
||||
class TrackingModeServiceTest extends TestCase
|
||||
{
|
||||
public function testDefaultTrackingModesAreRegistered()
|
||||
public function testDefaultTrackingModesAreRegistered(): void
|
||||
{
|
||||
$sut = (new TrackingModeServiceFactory($this))->create('punch');
|
||||
|
||||
@@ -36,14 +36,14 @@ class TrackingModeServiceTest extends TestCase
|
||||
self::assertContains('duration_fixed_begin', $ids);
|
||||
}
|
||||
|
||||
public function testGetActiveMode()
|
||||
public function testGetActiveMode(): void
|
||||
{
|
||||
$sut = (new TrackingModeServiceFactory($this))->create('punch');
|
||||
|
||||
self::assertInstanceOf(PunchInOutMode::class, $sut->getActiveMode());
|
||||
}
|
||||
|
||||
public function testGetActiveModeThrowsExceptionOnlyInvalidMode()
|
||||
public function testGetActiveModeThrowsExceptionOnlyInvalidMode(): void
|
||||
{
|
||||
$this->expectException(ServiceNotFoundException::class);
|
||||
$this->expectExceptionMessage('You have requested a non-existent service "xxxxxx"');
|
||||
|
||||
@@ -20,7 +20,7 @@ class UtilTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getRateCalculationData
|
||||
*/
|
||||
public function testCalculateRate(int|float $hourlyRate, int $duration, int|float $expectedRate)
|
||||
public function testCalculateRate(int|float $hourlyRate, int $duration, int|float $expectedRate): void
|
||||
{
|
||||
$this->assertEquals($expectedRate, Util::calculateRate($hourlyRate, $duration));
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class UtilTest extends TestCase
|
||||
yield [7360.99, 1234, 2523.1838];
|
||||
}
|
||||
|
||||
public function testCalculateRateWithRounding()
|
||||
public function testCalculateRateWithRounding(): void
|
||||
{
|
||||
$total = 0.00;
|
||||
$seconds = 0;
|
||||
|
||||
Reference in New Issue
Block a user