33namespace Tests \Unit ;
44
55use Tests \TestCase ;
6- use Laravel \ Socialite \ Two \ GitlabProvider ;
6+ use SocialiteProviders \ Dropbox \ Provider as DropboxDriver ;
77use Oneofftech \Identities \Facades \Identity ;
88use Oneofftech \Identities \IdentitiesManager ;
99use SocialiteProviders \Manager \SocialiteWasCalled ;
1010use SocialiteProviders \GitLab \GitLabExtendSocialite ;
1111use Illuminate \Foundation \Testing \DatabaseMigrations ;
12+ use InvalidArgumentException ;
13+ use Laravel \Socialite \Two \FacebookProvider ;
14+ use SocialiteProviders \GitLab \Provider as GitlabSocialiteProvider ;
1215
1316class IdentityServiceProviderTest extends TestCase
1417{
@@ -19,8 +22,41 @@ public function test_it_can_instantiate_the_gitlab_driver()
1922 $ factory = $ this ->app ->make (IdentitiesManager::class);
2023
2124 $ provider = $ factory ->driver ('gitlab ' );
25+
26+ $ this ->assertInstanceOf (GitlabSocialiteProvider::class, $ provider );
27+ }
28+
29+ public function test_it_can_instantiate_the_facebook_driver ()
30+ {
31+ $ this ->app ['config ' ]->set ('services.facebook ' , [
32+ 'client_id ' => 'aaa ' ,
33+ 'client_secret ' => 'bbb ' ,
34+ 'redirect ' => null ,
35+ ]);
36+
37+ $ factory = $ this ->app ->make (IdentitiesManager::class);
38+
39+ $ provider = $ factory ->driver ('facebook ' );
40+
41+ $ this ->assertInstanceOf (FacebookProvider::class, $ provider );
42+ }
43+
44+ public function test_non_existing_provider_throws ()
45+ {
46+ $ factory = $ this ->app ->make (IdentitiesManager::class);
47+
48+ $ this ->expectException (InvalidArgumentException::class);
49+
50+ $ provider = $ factory ->driver ('slurpbook ' );
51+ }
52+
53+ public function test_it_can_instantiate_the_dropbox_driver ()
54+ {
55+ $ factory = $ this ->app ->make (IdentitiesManager::class);
56+
57+ $ provider = $ factory ->driver ('dropbox ' );
2258
23- $ this ->assertInstanceOf (GitlabProvider ::class, $ provider );
59+ $ this ->assertInstanceOf (DropboxDriver ::class, $ provider );
2460 }
2561
2662 public function test_routes_are_registered ()
0 commit comments