Skip to content

Commit

Permalink
Implement GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
meritoo committed Nov 16, 2024
1 parent db05e9e commit 83dce4d
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions tests/Service/DateServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function provideDateFormattedUsingDefaults(): Generator
*/
public function provideDateFormattedUsingLocale(): Generator
{
$locale = 'en_EN';
$locale = 'en_US';
$dateString = '1900-02-01 08:25:40';

/*
Expand Down Expand Up @@ -387,21 +387,21 @@ public function testConstructor(): void
DateService::class,
OopVisibilityType::IS_PUBLIC,
3,
3
3,
);
}

/**
* @param DateTimeInterface $dateTime The date to format
* @param string $dateLength Type of date length
* @param string $expected Expected date
* @param DateTimeInterface $dateTime The date to format
* @param string $dateLength Type of date length
* @param string $expected Expected date
*
* @dataProvider provideDateFormattedUsingDefaults
*/
public function testFormatDateUsingDefaults(
DateTimeInterface $dateTime,
string $dateLength,
string $expected
string $expected,
): void {
static::bootKernel([
'environment' => 'default',
Expand All @@ -416,13 +416,13 @@ public function testFormatDateUsingDefaults(
}

/**
* @param int $dateType Type/length of date part in the returned string. One of constants of the
* @param int $dateType Type/length of date part in the returned string. One of constants of the
* \IntlDateFormatter class, e.g. \IntlDateFormatter::SHORT.
* @param int $timeType Type/length of time part in the returned string. One of constants of the
* @param int $timeType Type/length of time part in the returned string. One of constants of the
* \IntlDateFormatter class, e.g. \IntlDateFormatter::MEDIUM.
* @param string $locale Locale used to format given date
* @param DateTimeInterface $dateTime The date to format
* @param string $expected Expected date
* @param string $locale Locale used to format given date
* @param DateTimeInterface $dateTime The date to format
* @param string $expected Expected date
*
* @dataProvider provideDateFormattedUsingLocale
*/
Expand All @@ -431,7 +431,7 @@ public function testFormatDateUsingLocaleAndDefaults(
int $timeType,
string $locale,
DateTimeInterface $dateTime,
string $expected
string $expected,
): void {
static::bootKernel([
'environment' => 'default',
Expand All @@ -443,21 +443,21 @@ public function testFormatDateUsingLocaleAndDefaults(
$dateType,
$timeType,
$locale,
$dateTime
$dateTime,
)
;

static::assertSame($expected, $formatted);
}

/**
* @param int $dateType Type/length of date part in the returned string. One of constants of the
* @param int $dateType Type/length of date part in the returned string. One of constants of the
* \IntlDateFormatter class, e.g. \IntlDateFormatter::SHORT.
* @param int $timeType Type/length of time part in the returned string. One of constants of the
* @param int $timeType Type/length of time part in the returned string. One of constants of the
* \IntlDateFormatter class, e.g. \IntlDateFormatter::MEDIUM.
* @param string $locale Locale used to format given date
* @param DateTimeInterface $dateTime The date to format
* @param string $expected Expected date
* @param string $locale Locale used to format given date
* @param DateTimeInterface $dateTime The date to format
* @param string $expected Expected date
*
* @dataProvider provideDateFormattedUsingLocale
*/
Expand All @@ -466,38 +466,39 @@ public function testFormatDateUsingLocaleAndTestEnvironment(
int $timeType,
string $locale,
DateTimeInterface $dateTime,
string $expected
string $expected,
): void {
$formatted = $this
->dateService
->formatDateUsingLocale(
$dateType,
$timeType,
$locale,
$dateTime
$dateTime,
)
;

static::assertSame($expected, $formatted);
}

/**
* @param DateTimeInterface $dateTime The date to format
* @param string $dateLength Type of date length
* @param string $expected Expected date
* @param DateTimeInterface $dateTime The date to format
* @param string $dateLength Type of date length
* @param string $expected Expected date
*
* @dataProvider provideDateFormattedUsingTestEnvironment
*/
public function testFormatDateUsingTestEnvironment(
DateTimeInterface $dateTime,
string $dateLength,
string $expected
string $expected,
): void {
static::assertSame($expected, $this->dateService->formatDate($dateTime, $dateLength));
}

/**
* @param string $dateLength Unknown type of date length
*
* @dataProvider provideUnknownDateLength
*/
public function testFormatDateUsingUnknownDateLength(string $dateLength): void
Expand All @@ -508,13 +509,13 @@ public function testFormatDateUsingUnknownDateLength(string $dateLength): void

/**
* @param string $dateLength Type of date length
* @param string $expected Expected date format
* @param string $expected Expected date format
*
* @dataProvider provideDateFormatUsingDefaults
*/
public function testGetFormatUsingDefaults(
string $dateLength,
string $expected
string $expected,
): void {
static::bootKernel([
'environment' => 'default',
Expand All @@ -530,19 +531,20 @@ public function testGetFormatUsingDefaults(

/**
* @param string $dateLength Type of date length
* @param string $expected Expected date format
* @param string $expected Expected date format
*
* @dataProvider provideDateFormatUsingTestEnvironment
*/
public function testGetFormatUsingTestEnvironment(
string $dateLength,
string $expected
string $expected,
): void {
static::assertSame($expected, $this->dateService->getFormat($dateLength));
}

/**
* @param string $dateLength Unknown type of date length
*
* @dataProvider provideUnknownDateLength
*/
public function testGetFormatUsingUnknownDateLength(string $dateLength): void
Expand Down

0 comments on commit 83dce4d

Please sign in to comment.