-
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
03d6ed2
commit 57628d7
Showing
3 changed files
with
168 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 IsAfterOrEqualToTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* | ||
* @dataProvider dataProvider | ||
* | ||
* @covers ::isAfterOrEqualTo | ||
*/ | ||
public function is_after_or_equal_to_works( | ||
bool $expectedResult, | ||
Weekday $weekday, | ||
Weekday $comparator, | ||
): void { | ||
// -- Act & Assert | ||
self::assertSame($expectedResult, $weekday->isAfterOrEqualTo($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' => [ | ||
true, | ||
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 IsNotAfterOrEqualToTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* | ||
* @dataProvider dataProvider | ||
* | ||
* @covers ::isNotAfterOrEqualTo | ||
*/ | ||
public function is_not_after_or_equal_to_works( | ||
bool $expectedResult, | ||
Weekday $weekday, | ||
Weekday $comparator, | ||
): void { | ||
// -- Act & Assert | ||
self::assertSame($expectedResult, $weekday->isNotAfterOrEqualTo($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' => [ | ||
false, | ||
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 IsNotEqualToTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* | ||
* @dataProvider dataProvider | ||
* | ||
* @covers ::isNotEqualTo | ||
*/ | ||
public function is_not_equal_to_works( | ||
bool $expectedResult, | ||
Weekday $weekday, | ||
Weekday $comparator, | ||
): void { | ||
// -- Act & Assert | ||
self::assertSame($expectedResult, $weekday->isNotEqualTo($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' => [ | ||
false, | ||
Weekday::TUESDAY, | ||
Weekday::TUESDAY, | ||
], | ||
'1 day later' => [ | ||
true, | ||
Weekday::TUESDAY, | ||
Weekday::MONDAY, | ||
], | ||
]; | ||
} | ||
} |