Skip to content

feat(datetime): introduce DateTime component #800

feat(datetime): introduce DateTime component

feat(datetime): introduce DateTime component #800

Triggered via push April 1, 2024 17:39
Status Failure
Total duration 5m 44s
Artifacts
Matrix: mutation tests
Fit to window
Zoom out
Zoom in

Annotations

1 error and 10 warnings
mutation tests (8.3, ubuntu-latest)
Process completed with exit code 2.
mutation tests (8.3, ubuntu-latest): src/Psl/DateTime/DateTime.php#L77
Escaped Mutant for Mutator "LessThan": --- Original +++ New @@ @@ */ private function __construct(Timezone $timezone, Timestamp $timestamp, int $year, int $month, int $day, int $hours, int $minutes, int $seconds, int $nanoseconds) { - if ($nanoseconds < 0 || $nanoseconds >= NANOSECONDS_PER_SECOND || $seconds < 0 || $seconds >= 60 || $minutes < 0 || $minutes >= 60 || $hours < 0 || $hours >= 24 || $month < 1 || $month > 12 || $day < 1 || $day > 31 || $day > Month::from($month)->getDaysForYear($year)) { + if ($nanoseconds < 0 || $nanoseconds >= NANOSECONDS_PER_SECOND || $seconds < 0 || $seconds >= 60 || $minutes < 0 || $minutes >= 60 || $hours < 0 || $hours >= 24 || $month <= 1 || $month > 12 || $day < 1 || $day > 31 || $day > Month::from($month)->getDaysForYear($year)) { throw new Exception\InvalidArgumentException('One or more components of the date-time are out of valid ranges.'); } $this->timestamp = $timestamp;
mutation tests (8.3, ubuntu-latest): src/Psl/DateTime/DateTime.php#L77
Escaped Mutant for Mutator "GreaterThan": --- Original +++ New @@ @@ */ private function __construct(Timezone $timezone, Timestamp $timestamp, int $year, int $month, int $day, int $hours, int $minutes, int $seconds, int $nanoseconds) { - if ($nanoseconds < 0 || $nanoseconds >= NANOSECONDS_PER_SECOND || $seconds < 0 || $seconds >= 60 || $minutes < 0 || $minutes >= 60 || $hours < 0 || $hours >= 24 || $month < 1 || $month > 12 || $day < 1 || $day > 31 || $day > Month::from($month)->getDaysForYear($year)) { + if ($nanoseconds < 0 || $nanoseconds >= NANOSECONDS_PER_SECOND || $seconds < 0 || $seconds >= 60 || $minutes < 0 || $minutes >= 60 || $hours < 0 || $hours >= 24 || $month < 1 || $month >= 12 || $day < 1 || $day > 31 || $day > Month::from($month)->getDaysForYear($year)) { throw new Exception\InvalidArgumentException('One or more components of the date-time are out of valid ranges.'); } $this->timestamp = $timestamp;
mutation tests (8.3, ubuntu-latest): src/Psl/DateTime/DateTime.php#L128
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ * * @mutation-free */ - public static function todayAt(int $hours, int $minutes, int $seconds = 0, int $nanoseconds = 0, ?Timezone $timezone = null) : DateTime + public static function todayAt(int $hours, int $minutes, int $seconds = 1, int $nanoseconds = 0, ?Timezone $timezone = null) : DateTime { return self::now($timezone)->withTime($hours, $minutes, $seconds, $nanoseconds); }
mutation tests (8.3, ubuntu-latest): src/Psl/DateTime/DateTime.php#L128
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ * * @mutation-free */ - public static function todayAt(int $hours, int $minutes, int $seconds = 0, int $nanoseconds = 0, ?Timezone $timezone = null) : DateTime + public static function todayAt(int $hours, int $minutes, int $seconds = 0, int $nanoseconds = 1, ?Timezone $timezone = null) : DateTime { return self::now($timezone)->withTime($hours, $minutes, $seconds, $nanoseconds); }
mutation tests (8.3, ubuntu-latest): src/Psl/DateTime/DateTime.php#L150
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ * * @pure */ - public static function fromParts(Timezone $timezone, int $year, Month|int $month, int $day, int $hours = 0, int $minutes = 0, int $seconds = 0, int $nanoseconds = 0) : self + public static function fromParts(Timezone $timezone, int $year, Month|int $month, int $day, int $hours = 1, int $minutes = 0, int $seconds = 0, int $nanoseconds = 0) : self { if ($month instanceof Month) { $month = $month->value;
mutation tests (8.3, ubuntu-latest): src/Psl/DateTime/DateTime.php#L150
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ * * @pure */ - public static function fromParts(Timezone $timezone, int $year, Month|int $month, int $day, int $hours = 0, int $minutes = 0, int $seconds = 0, int $nanoseconds = 0) : self + public static function fromParts(Timezone $timezone, int $year, Month|int $month, int $day, int $hours = 0, int $minutes = 1, int $seconds = 0, int $nanoseconds = 0) : self { if ($month instanceof Month) { $month = $month->value;
mutation tests (8.3, ubuntu-latest): src/Psl/DateTime/DateTime.php#L150
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ * * @pure */ - public static function fromParts(Timezone $timezone, int $year, Month|int $month, int $day, int $hours = 0, int $minutes = 0, int $seconds = 0, int $nanoseconds = 0) : self + public static function fromParts(Timezone $timezone, int $year, Month|int $month, int $day, int $hours = 0, int $minutes = 0, int $seconds = 1, int $nanoseconds = 0) : self { if ($month instanceof Month) { $month = $month->value;
mutation tests (8.3, ubuntu-latest): src/Psl/DateTime/DateTime.php#L150
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ * * @pure */ - public static function fromParts(Timezone $timezone, int $year, Month|int $month, int $day, int $hours = 0, int $minutes = 0, int $seconds = 0, int $nanoseconds = 0) : self + public static function fromParts(Timezone $timezone, int $year, Month|int $month, int $day, int $hours = 0, int $minutes = 0, int $seconds = 0, int $nanoseconds = 1) : self { if ($month instanceof Month) { $month = $month->value;
mutation tests (8.3, ubuntu-latest): src/Psl/DateTime/DateTime.php#L168
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $calendar = IntlCalendar::createInstance(Internal\to_intl_timezone($timezone)); $calendar->set($year, $month - 1, $day, $hours, $minutes, $seconds); // Validate the date-time components by comparing them to what was set - if (!($calendar->get(IntlCalendar::FIELD_YEAR) === $year && $calendar->get(IntlCalendar::FIELD_MONTH) + 1 === $month && $calendar->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $day && $calendar->get(IntlCalendar::FIELD_HOUR_OF_DAY) === $hours && $calendar->get(IntlCalendar::FIELD_MINUTE) === $minutes && $calendar->get(IntlCalendar::FIELD_SECOND) === $seconds)) { + if (!(($calendar->get(IntlCalendar::FIELD_YEAR) === $year || $calendar->get(IntlCalendar::FIELD_MONTH) + 1 === $month) && $calendar->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $day && $calendar->get(IntlCalendar::FIELD_HOUR_OF_DAY) === $hours && $calendar->get(IntlCalendar::FIELD_MINUTE) === $minutes && $calendar->get(IntlCalendar::FIELD_SECOND) === $seconds)) { throw new Exception\InvalidArgumentException('The given components do not form a valid date-time.'); } $timestampInSeconds = (int) ($calendar->getTime() / (float) MILLISECONDS_PER_SECOND);
mutation tests (8.3, ubuntu-latest): src/Psl/DateTime/DateTime.php#L168
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $calendar = IntlCalendar::createInstance(Internal\to_intl_timezone($timezone)); $calendar->set($year, $month - 1, $day, $hours, $minutes, $seconds); // Validate the date-time components by comparing them to what was set - if (!($calendar->get(IntlCalendar::FIELD_YEAR) === $year && $calendar->get(IntlCalendar::FIELD_MONTH) + 1 === $month && $calendar->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $day && $calendar->get(IntlCalendar::FIELD_HOUR_OF_DAY) === $hours && $calendar->get(IntlCalendar::FIELD_MINUTE) === $minutes && $calendar->get(IntlCalendar::FIELD_SECOND) === $seconds)) { + if (!(($calendar->get(IntlCalendar::FIELD_YEAR) === $year && $calendar->get(IntlCalendar::FIELD_MONTH) + 1 === $month || $calendar->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $day) && $calendar->get(IntlCalendar::FIELD_HOUR_OF_DAY) === $hours && $calendar->get(IntlCalendar::FIELD_MINUTE) === $minutes && $calendar->get(IntlCalendar::FIELD_SECOND) === $seconds)) { throw new Exception\InvalidArgumentException('The given components do not form a valid date-time.'); } $timestampInSeconds = (int) ($calendar->getTime() / (float) MILLISECONDS_PER_SECOND);