diff --git a/src/Test/AuthTestTrait.php b/src/Test/AuthTestTrait.php new file mode 100644 index 00000000..9b752788 --- /dev/null +++ b/src/Test/AuthTestTrait.php @@ -0,0 +1,23 @@ +login($user); + $this->assertTrue($authentication->isLoggedIn()); + + $this->resetAuthServices(); + + $this->assertFalse(service('authentication')->check()); + } + + public function testResetServicesResetsAuthorization() + { + $authorization = service('authorization'); + $authorization->setUserModel(model(UserFaker::class)); + + $this->resetAuthServices(); + + $authorization = service('authorization'); + $model = $this->getPrivateProperty($authorization, 'userModel'); + + $this->assertNotInstanceOf(UserFaker::class, $model); + } +}