Skip to content

Commit

Permalink
Add isEqualTo test coverage for weekday
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Kolb committed Jun 9, 2024
1 parent 0db48c7 commit 4897afe
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions tests/Weekday/IsEqualToTest.php
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 IsEqualToTest extends TestCase
{
/**
* @test
*
* @dataProvider dataProvider
*
* @covers ::isEqualTo
*/
public function is_equal_to_works(
bool $expectedResult,
Weekday $weekday,
Weekday $comparator,
): void {
// -- Act & Assert
self::assertSame($expectedResult, $weekday->isEqualTo($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' => [
false,
Weekday::TUESDAY,
Weekday::MONDAY,
],
];
}
}

0 comments on commit 4897afe

Please sign in to comment.