-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02cecc4
commit bd42c65
Showing
7 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace PyaeSoneAung\LaravelMyanmarTools\Carbon; | ||
|
||
class IsIndependenceDay | ||
{ | ||
public function __invoke() | ||
{ | ||
return function (): bool { | ||
/** @var \Illuminate\Support\Carbon $this */ | ||
if ($this->year < 1948) { | ||
return false; | ||
} | ||
|
||
return $this->month === 1 && $this->day === 4; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace PyaeSoneAung\LaravelMyanmarTools\Carbon; | ||
|
||
class IsLabourDay | ||
{ | ||
public function __invoke() | ||
{ | ||
return function (): bool { | ||
/** @var \Illuminate\Support\Carbon $this */ | ||
return $this->month === 5 && $this->day === 1; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace PyaeSoneAung\LaravelMyanmarTools\Carbon; | ||
|
||
class IsMartyrsDay | ||
{ | ||
public function __invoke() | ||
{ | ||
return function (): bool { | ||
/** @var \Illuminate\Support\Carbon $this */ | ||
if ($this->year < 1947) { | ||
return false; | ||
} | ||
|
||
return $this->month === 7 && $this->day === 19; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace PyaeSoneAung\LaravelMyanmarTools\Carbon; | ||
|
||
class IsPeasantsDay | ||
{ | ||
public function __invoke() | ||
{ | ||
return function (): bool { | ||
/** @var \Illuminate\Support\Carbon $this */ | ||
if ($this->year < 1962) { | ||
return false; | ||
} | ||
|
||
return $this->month === 3 && $this->day === 2; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace PyaeSoneAung\LaravelMyanmarTools\Carbon; | ||
|
||
class IsUnionDay | ||
{ | ||
public function __invoke() | ||
{ | ||
return function (): bool { | ||
/** @var \Illuminate\Support\Carbon $this */ | ||
if ($this->year < 1947) { | ||
return false; | ||
} | ||
|
||
return $this->month === 2 && $this->day === 12; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Carbon; | ||
|
||
it('can check independence day', function () { | ||
expect(Carbon::parse('2023-01-04')->isIndependenceDay())->toBeTrue(); | ||
expect(Carbon::parse('1947-01-04')->isIndependenceDay())->toBeFalse(); | ||
}); | ||
|
||
it('can check union day', function () { | ||
expect(Carbon::parse('2023-02-12')->isUnionDay())->toBeTrue(); | ||
expect(Carbon::parse('1946-02-12')->isUnionDay())->toBeFalse(); | ||
}); | ||
|
||
it('can check peasants\' day', function () { | ||
expect(Carbon::parse('2023-03-02')->isPeasantsDay())->toBeTrue(); | ||
expect(Carbon::parse('1961-03-02')->isPeasantsDay())->toBeFalse(); | ||
}); | ||
|
||
it('can check labour day', function () { | ||
expect(Carbon::parse('2023-05-01')->isLabourDay())->toBeTrue(); | ||
expect(Carbon::parse('2023-05-02')->isLabourDay())->toBeFalse(); | ||
}); | ||
|
||
it('can check martyr\'s day', function () { | ||
expect(Carbon::parse('2023-07-19')->isMartyrsDay())->toBeTrue(); | ||
expect(Carbon::parse('1946-07-19')->isMartyrsDay())->toBeFalse(); | ||
}); |