Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from laravel-enso/feature/roles
Feature/roles
- Loading branch information
Showing
7 changed files
with
74 additions
and
6 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,7 @@ | ||
<?php | ||
|
||
return [ | ||
'birthdays' => [ | ||
'roles' => ['*'], | ||
], | ||
]; |
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
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,51 @@ | ||
<?php | ||
|
||
use Carbon\Carbon; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Illuminate\Support\Facades\Config; | ||
use LaravelEnso\Calendar\Calendars\BirthdayCalendar; | ||
use LaravelEnso\Calendar\Enums\Colors; | ||
use LaravelEnso\Calendar\Models\Calendar; | ||
use LaravelEnso\Core\Models\User; | ||
use LaravelEnso\People\Models\Person; | ||
use Tests\TestCase; | ||
|
||
class CalendarTest extends TestCase | ||
{ | ||
use RefreshDatabase; | ||
|
||
protected Calendar $calendar; | ||
protected Carbon $date; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->seed(); | ||
|
||
$this->actingAs(User::first()); | ||
|
||
$this->calendar = Calendar::factory()->create(); | ||
} | ||
|
||
/** @test */ | ||
public function create_calendar() | ||
{ | ||
$result = $this->post(route('core.calendar.store'), [ | ||
'name' => 'test', | ||
'color' => Colors::Red, | ||
'private' => false, | ||
]); | ||
|
||
$this->assertTrue(Calendar::whereName('test')->exists()); | ||
} | ||
|
||
/** @test */ | ||
public function can_limit_birthday_calendar_roles() | ||
{ | ||
Config::set('enso.calendar.birthdays.roles', []); | ||
|
||
$this->assertEmpty((new BirthdayCalendar()) | ||
->events(Person::first()->birthday, Person::first()->birthday->addDay())); | ||
} | ||
} |
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
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