Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Nov 12, 2023
1 parent 8cdc677 commit aced489
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ parameters:
- '#should return (\S*)(static|\$this)\(Carbon\\Carbon\)(\|null)? but returns Carbon\\Carbon(Interface)?(\|null)?\.$#'
- '#should return (\S*)(static|\$this)\(Carbon\\CarbonImmutable\)(\|null)? but returns Carbon\\Carbon(Immutable|Interface)(\|null)?\.$#'
- '#should return (\S*)\$this\(Carbon\\CarbonInterval\)(\|null)? but returns static\(Carbon\\CarbonInterval\)(\|null)?\.$#'
- '#should return (\S*)static\(Carbon\\CarbonInterval\)(\|null)? but returns Carbon\\CarbonInterval(\|null)?\.$#'
- '#^PHPDoc tag @return with type Carbon\\CarbonTimeZone is not subtype of native type static\(Carbon\\CarbonTimeZone\)\.$#'
- '#^PHPDoc tag @mixin contains invalid type Carbon\\Traits\\DeprecatedProperties\.$#'
- '#^Access to an undefined property DatePeriod::\$include_end_date\.$#'
Expand Down
2 changes: 2 additions & 0 deletions src/Carbon/CarbonPeriod.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@
use RuntimeException;
use Throwable;

// @codeCoverageIgnoreStart
require PHP_VERSION < 8.2
? __DIR__.'/../../lazy/Carbon/ProtectedDatePeriod.php'
: __DIR__.'/../../lazy/Carbon/UnprotectedDatePeriod.php';
// @codeCoverageIgnoreEnd

/**
* Substitution of DatePeriod with some modifications and many more features.
Expand Down
2 changes: 1 addition & 1 deletion tests/CarbonInterval/FromStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static function dataForValidStrings(): Generator
// big numbers
yield ['1999999999999.5 hours', new CarbonInterval(0, 0, 0, 0, 1999999999999, 30, 0)];
yield [(0x7fffffffffffffff).' days', new CarbonInterval(0, 0, 0, 0x7fffffffffffffff, 0, 0, 0)];
yield ['1999999999999.5 hours -85 minutes', new CarbonInterval(0, 0, 0, 0, 1999999999999, 115, 0)];
yield ['1999999999999.5 hours -85 minutes', new CarbonInterval(0, 0, 0, 0, 1999999999999, -55, 0)];
yield ['2.333 seconds', new CarbonInterval(0, 0, 0, 0, 0, 0, 2, 333000)];
}

Expand Down
6 changes: 2 additions & 4 deletions tests/CarbonPeriod/MacroTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ class MacroTest extends AbstractTestCase
{
protected function tearDown(): void
{
$reflection = new ReflectionClass(static::$periodClass);

$reflection->getProperty('macros')
->setValue([]);
(new ReflectionClass(static::$periodClass))
->setStaticPropertyValue('macros', []);

parent::tearDown();
}
Expand Down

0 comments on commit aced489

Please sign in to comment.