Skip to content

Commit 66db2e7

Browse files
committed
Assert that exception is thrown when personal access client is missing
1 parent f3d096d commit 66db2e7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/PassportTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Laravel\Passport\PersonalAccessClient;
77
use Laravel\Passport\Token;
88
use PHPUnit\Framework\TestCase;
9+
use Laravel\Passport\ClientRepository;
910

1011
class PassportTest extends TestCase
1112
{
@@ -44,6 +45,17 @@ public function test_personal_access_client_instance_can_be_created()
4445
$this->assertInstanceOf(Passport::personalAccessClientModel(), $client);
4546
}
4647

48+
/**
49+
* @expectedException RuntimeException
50+
*/
51+
public function test_missing_personal_access_client_is_reported()
52+
{
53+
Passport::usePersonalAccessClientModel('PersonalAccessClientStub');
54+
55+
$clientRepository = new ClientRepository;
56+
$clientRepository->personalAccessClient();
57+
}
58+
4759
public function test_token_instance_can_be_created()
4860
{
4961
$token = Passport::token();
@@ -52,3 +64,11 @@ public function test_token_instance_can_be_created()
5264
$this->assertInstanceOf(Passport::tokenModel(), $token);
5365
}
5466
}
67+
68+
class PersonalAccessClientStub
69+
{
70+
public function exists()
71+
{
72+
return false;
73+
}
74+
}

0 commit comments

Comments
 (0)