-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Model::preventsLazyLoading() check added
- Loading branch information
Showing
2 changed files
with
10 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
namespace Spatie\Permission\Tests; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use DB; | ||
use Spatie\Permission\Contracts\Permission; | ||
use Spatie\Permission\Contracts\Role; | ||
|
@@ -769,6 +770,8 @@ public function it_can_reject_permission_based_on_logged_in_user_guard() | |
/** @test */ | ||
public function it_can_be_given_a_permission_on_role_when_lazy_loading_is_restricted() | ||
{ | ||
$this->assertTrue(Model::preventsLazyLoading()); | ||
|
||
try { | ||
$testRole = app(Role::class)->with('permissions')->get()->first(); | ||
|
||
|
@@ -783,6 +786,8 @@ public function it_can_be_given_a_permission_on_role_when_lazy_loading_is_restri | |
/** @test */ | ||
public function it_can_be_given_a_permission_on_user_when_lazy_loading_is_restricted() | ||
{ | ||
$this->assertTrue(Model::preventsLazyLoading()); | ||
|
||
try { | ||
User::create(['email' => '[email protected]']); | ||
$testUser = User::with('permissions')->get()->first(); | ||
|
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
namespace Spatie\Permission\Tests; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Support\Facades\DB; | ||
use Spatie\Permission\Contracts\Permission; | ||
use Spatie\Permission\Contracts\Role; | ||
|
@@ -861,6 +862,8 @@ public function it_does_not_detach_roles_when_user_soft_deleting() | |
/** @test */ | ||
public function it_can_be_given_a_role_on_permission_when_lazy_loading_is_restricted() | ||
{ | ||
$this->assertTrue(Model::preventsLazyLoading()); | ||
|
||
try { | ||
$testPermission = app(Permission::class)->with('roles')->get()->first(); | ||
|
||
|
@@ -875,6 +878,8 @@ public function it_can_be_given_a_role_on_permission_when_lazy_loading_is_restri | |
/** @test */ | ||
public function it_can_be_given_a_role_on_user_when_lazy_loading_is_restricted() | ||
{ | ||
$this->assertTrue(Model::preventsLazyLoading()); | ||
|
||
try { | ||
User::create(['email' => '[email protected]']); | ||
$user = User::with('roles')->get()->first(); | ||
|