File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public function __construct(array $config, $userEmail = '')
26
26
$ this ->config = $ config ;
27
27
28
28
// create an instance of the google client for OAuth2
29
- $ this ->client = new Google_Client ();
29
+ $ this ->client = new Google_Client (array_get ( $ config , ' config ' , []) );
30
30
31
31
// set application name
32
32
$ this ->client ->setApplicationName (array_get ($ config , 'application_name ' , '' ));
@@ -62,7 +62,7 @@ public function getClient()
62
62
* Setter for the google client.
63
63
*
64
64
* @param string $client
65
- *
65
+ *
66
66
* @return self
67
67
*/
68
68
public function setClient (Google_Client $ client )
@@ -126,7 +126,7 @@ protected function useAssertCredentials($userEmail = '')
126
126
127
127
$ this ->client ->setAuthConfig ($ serviceJsonUrl );
128
128
129
- if ($ userEmail ) {
129
+ if (! empty ( $ userEmail) ) {
130
130
$ this ->client ->setSubject ($ userEmail );
131
131
}
132
132
Original file line number Diff line number Diff line change 55
55
*/
56
56
'file ' => env ('GOOGLE_SERVICE_ACCOUNT_JSON_LOCATION ' , '' )
57
57
],
58
+
59
+ /*
60
+ |----------------------------------------------------------------------------
61
+ | Additional config for the Google Client
62
+ |----------------------------------------------------------------------------
63
+ |
64
+ | Set any additional config variables supported by the Google Client
65
+ | Details can be found here:
66
+ | https://github.com/google/google-api-php-client/blob/master/src/Google/Client.php
67
+ |
68
+ | NOTE: If client id is specified here, it will get over written by the one above.
69
+ |
70
+ */
71
+ 'config ' => [],
58
72
];
Original file line number Diff line number Diff line change @@ -19,6 +19,17 @@ public function testClientGetter()
19
19
$ this ->assertInstanceOf ('Google_Client ' , $ client ->getClient ());
20
20
}
21
21
22
+ public function testClientGetterWithAdditionalConfig ()
23
+ {
24
+ $ client = Mockery::mock ('PulkitJalan\Google\Client ' , [[
25
+ 'config ' => [
26
+ 'subject ' => 'test ' ,
27
+ ],
28
+ ]])->makePartial ();
29
+
30
+ $ this ->assertEquals ($ client ->getClient ()->getConfig ('subject ' ), 'test ' );
31
+ }
32
+
22
33
public function testServiceMake ()
23
34
{
24
35
$ client = Mockery::mock ('PulkitJalan\Google\Client ' , [[]])->makePartial ();
You can’t perform that action at this time.
0 commit comments