Skip to content

Commit

Permalink
Assert that exception is thrown when personal access client is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravmak committed Sep 24, 2018
1 parent f3d096d commit 66db2e7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/PassportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Laravel\Passport\PersonalAccessClient;
use Laravel\Passport\Token;
use PHPUnit\Framework\TestCase;
use Laravel\Passport\ClientRepository;

class PassportTest extends TestCase
{
Expand Down Expand Up @@ -44,6 +45,17 @@ public function test_personal_access_client_instance_can_be_created()
$this->assertInstanceOf(Passport::personalAccessClientModel(), $client);
}

/**
* @expectedException RuntimeException
*/
public function test_missing_personal_access_client_is_reported()
{
Passport::usePersonalAccessClientModel('PersonalAccessClientStub');

$clientRepository = new ClientRepository;
$clientRepository->personalAccessClient();
}

public function test_token_instance_can_be_created()
{
$token = Passport::token();
Expand All @@ -52,3 +64,11 @@ public function test_token_instance_can_be_created()
$this->assertInstanceOf(Passport::tokenModel(), $token);
}
}

class PersonalAccessClientStub
{
public function exists()
{
return false;
}
}

0 comments on commit 66db2e7

Please sign in to comment.