Skip to content

Commit

Permalink
Add coverage for date->weekday()
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Kolb committed Jun 9, 2024
1 parent 4897afe commit 2d9f776
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/Date/WeekdayTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

namespace DigitalCraftsman\DateTimePrecision\Date;

use DigitalCraftsman\DateTimePrecision\Date;
use DigitalCraftsman\DateTimePrecision\Weekday;
use PHPUnit\Framework\TestCase;

/** @coversDefaultClass \DigitalCraftsman\DateTimePrecision\Date */
final class WeekdayTest extends TestCase
{
/**
* @test
*
* @dataProvider dataProviderForWeekday
*
* @covers ::weekday
*/
public function date_works(
Weekday $expectedResult,
Date $date,
): void {
// -- Act & Assert
self::assertEquals($expectedResult, $date->weekday());
}

/**
* @return array<string, array{
* 0: Weekday,
* 1: Date,
* }>
*/
public static function dataProviderForWeekday(): array
{
return [
'saturday' => [
Weekday::SATURDAY,
Date::fromString('2022-10-08'),
],
'monday' => [
Weekday::MONDAY,
Date::fromString('2022-10-10'),
],
];
}
}

0 comments on commit 2d9f776

Please sign in to comment.