-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christian Kolb
committed
Jun 9, 2024
1 parent
3b9101a
commit dfde9bc
Showing
4 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DigitalCraftsman\DateTimePrecision\Weekday; | ||
|
||
use DigitalCraftsman\DateTimePrecision\Weekday; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** @coversDefaultClass \DigitalCraftsman\DateTimePrecision\Weekday */ | ||
final class IsAfterTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* | ||
* @dataProvider dataProvider | ||
* | ||
* @covers ::isAfter | ||
*/ | ||
public function is_after_works( | ||
bool $expectedResult, | ||
Weekday $weekday, | ||
Weekday $comparator, | ||
): void { | ||
// -- Act & Assert | ||
self::assertSame($expectedResult, $weekday->isAfter($comparator)); | ||
} | ||
|
||
/** | ||
* @return array<string, array{ | ||
* 0: boolean, | ||
* 1: Weekday, | ||
* 2: Weekday, | ||
* }> | ||
*/ | ||
public static function dataProvider(): array | ||
{ | ||
return [ | ||
'1 day before' => [ | ||
false, | ||
Weekday::MONDAY, | ||
Weekday::TUESDAY, | ||
], | ||
'same day' => [ | ||
false, | ||
Weekday::TUESDAY, | ||
Weekday::TUESDAY, | ||
], | ||
'1 day later' => [ | ||
true, | ||
Weekday::TUESDAY, | ||
Weekday::MONDAY, | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DigitalCraftsman\DateTimePrecision\Weekday; | ||
|
||
use DigitalCraftsman\DateTimePrecision\Weekday; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** @coversDefaultClass \DigitalCraftsman\DateTimePrecision\Weekday */ | ||
final class IsBeforeOrEqualToTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* | ||
* @dataProvider dataProvider | ||
* | ||
* @covers ::isBeforeOrEqualTo | ||
*/ | ||
public function is_before_or_equal_to_works( | ||
bool $expectedResult, | ||
Weekday $weekday, | ||
Weekday $comparator, | ||
): void { | ||
// -- Act & Assert | ||
self::assertSame($expectedResult, $weekday->isBeforeOrEqualTo($comparator)); | ||
} | ||
|
||
/** | ||
* @return array<string, array{ | ||
* 0: boolean, | ||
* 1: Weekday, | ||
* 2: Weekday, | ||
* }> | ||
*/ | ||
public static function dataProvider(): array | ||
{ | ||
return [ | ||
'1 day before' => [ | ||
true, | ||
Weekday::MONDAY, | ||
Weekday::TUESDAY, | ||
], | ||
'same day' => [ | ||
true, | ||
Weekday::TUESDAY, | ||
Weekday::TUESDAY, | ||
], | ||
'1 day later' => [ | ||
false, | ||
Weekday::TUESDAY, | ||
Weekday::MONDAY, | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DigitalCraftsman\DateTimePrecision\Weekday; | ||
|
||
use DigitalCraftsman\DateTimePrecision\Weekday; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** @coversDefaultClass \DigitalCraftsman\DateTimePrecision\Weekday */ | ||
final class IsNotAfterTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* | ||
* @dataProvider dataProvider | ||
* | ||
* @covers ::isNotAfter | ||
*/ | ||
public function is_not_after_works( | ||
bool $expectedResult, | ||
Weekday $weekday, | ||
Weekday $comparator, | ||
): void { | ||
// -- Act & Assert | ||
self::assertSame($expectedResult, $weekday->isNotAfter($comparator)); | ||
} | ||
|
||
/** | ||
* @return array<string, array{ | ||
* 0: boolean, | ||
* 1: Weekday, | ||
* 2: Weekday, | ||
* }> | ||
*/ | ||
public static function dataProvider(): array | ||
{ | ||
return [ | ||
'1 day before' => [ | ||
true, | ||
Weekday::MONDAY, | ||
Weekday::TUESDAY, | ||
], | ||
'same day' => [ | ||
true, | ||
Weekday::TUESDAY, | ||
Weekday::TUESDAY, | ||
], | ||
'1 day later' => [ | ||
false, | ||
Weekday::TUESDAY, | ||
Weekday::MONDAY, | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DigitalCraftsman\DateTimePrecision\Weekday; | ||
|
||
use DigitalCraftsman\DateTimePrecision\Weekday; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** @coversDefaultClass \DigitalCraftsman\DateTimePrecision\Weekday */ | ||
final class IsNotBeforeOrEqualToTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* | ||
* @dataProvider dataProvider | ||
* | ||
* @covers ::isNotBeforeOrEqualTo | ||
*/ | ||
public function is_not_before_or_equal_to_works( | ||
bool $expectedResult, | ||
Weekday $weekday, | ||
Weekday $comparator, | ||
): void { | ||
// -- Act & Assert | ||
self::assertSame($expectedResult, $weekday->isNotBeforeOrEqualTo($comparator)); | ||
} | ||
|
||
/** | ||
* @return array<string, array{ | ||
* 0: boolean, | ||
* 1: Weekday, | ||
* 2: Weekday, | ||
* }> | ||
*/ | ||
public static function dataProvider(): array | ||
{ | ||
return [ | ||
'1 day before' => [ | ||
false, | ||
Weekday::MONDAY, | ||
Weekday::TUESDAY, | ||
], | ||
'same day' => [ | ||
false, | ||
Weekday::TUESDAY, | ||
Weekday::TUESDAY, | ||
], | ||
'1 day later' => [ | ||
true, | ||
Weekday::TUESDAY, | ||
Weekday::MONDAY, | ||
], | ||
]; | ||
} | ||
} |