Skip to content

Commit

Permalink
briannesbitt#398 Skip tests with easter_days() if ext-calendar is mis…
Browse files Browse the repository at this point in the history
…sing
  • Loading branch information
kylekatarnls committed Nov 18, 2019
1 parent 89d14fb commit 8d7852a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/Carbon/MacroTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public function testInstance()

public function testCarbonIsMacroableWhenNotCalledDynamically()
{
if (!function_exists('easter_days')) {
$this->markTestSkipped('This test requires ext-calendar to be enabled.');
}

Carbon::macro('easterDays', function ($year = 2019) {
return easter_days($year);
});
Expand All @@ -47,6 +51,10 @@ public function testCarbonIsMacroableWhenNotCalledDynamically()

public function testCarbonIsMacroableWhenNotCalledDynamicallyUsingThis()
{
if (!function_exists('easter_days')) {
$this->markTestSkipped('This test requires ext-calendar to be enabled.');
}

Carbon::macro('diffFromEaster', function ($year) {
/** @var CarbonInterface $date */
$date = $this;
Expand All @@ -67,6 +75,10 @@ public function testCarbonIsMacroableWhenNotCalledDynamicallyUsingThis()

public function testCarbonIsMacroableWhenCalledStatically()
{
if (!function_exists('easter_days')) {
$this->markTestSkipped('This test requires ext-calendar to be enabled.');
}

Carbon::macro('easterDate', function ($year) {
return Carbon::create($year, 3, 21)->addDays(easter_days($year));
});
Expand Down
12 changes: 12 additions & 0 deletions tests/CarbonImmutable/MacroTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class MacroTest extends AbstractTestCaseWithOldNow
{
public function testCarbonIsMacroableWhenNotCalledDynamically()
{
if (!function_exists('easter_days')) {
$this->markTestSkipped('This test requires ext-calendar to be enabled.');
}

Carbon::macro('easterDays', function ($year = 2019) {
return easter_days($year);
});
Expand All @@ -39,6 +43,10 @@ public function testCarbonIsMacroableWhenNotCalledDynamically()

public function testCarbonIsMacroableWhenNotCalledDynamicallyUsingThis()
{
if (!function_exists('easter_days')) {
$this->markTestSkipped('This test requires ext-calendar to be enabled.');
}

Carbon::macro('diffFromEaster', function ($year) {
/** @var Carbon $date */
$date = $this;
Expand All @@ -59,6 +67,10 @@ public function testCarbonIsMacroableWhenNotCalledDynamicallyUsingThis()

public function testCarbonIsMacroableWhenCalledStatically()
{
if (!function_exists('easter_days')) {
$this->markTestSkipped('This test requires ext-calendar to be enabled.');
}

Carbon::macro('easterDate', function ($year) {
return Carbon::create($year, 3, 21)->addDays(easter_days($year));
});
Expand Down

0 comments on commit 8d7852a

Please sign in to comment.