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 = '')
2626 $ this ->config = $ config ;
2727
2828 // 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 ' , []) );
3030
3131 // set application name
3232 $ this ->client ->setApplicationName (array_get ($ config , 'application_name ' , '' ));
@@ -62,7 +62,7 @@ public function getClient()
6262 * Setter for the google client.
6363 *
6464 * @param string $client
65- *
65+ *
6666 * @return self
6767 */
6868 public function setClient (Google_Client $ client )
@@ -126,7 +126,7 @@ protected function useAssertCredentials($userEmail = '')
126126
127127 $ this ->client ->setAuthConfig ($ serviceJsonUrl );
128128
129- if ($ userEmail ) {
129+ if (! empty ( $ userEmail) ) {
130130 $ this ->client ->setSubject ($ userEmail );
131131 }
132132
Original file line number Diff line number Diff line change 5555 */
5656 'file ' => env ('GOOGLE_SERVICE_ACCOUNT_JSON_LOCATION ' , '' )
5757 ],
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 ' => [],
5872];
Original file line number Diff line number Diff line change @@ -19,6 +19,17 @@ public function testClientGetter()
1919 $ this ->assertInstanceOf ('Google_Client ' , $ client ->getClient ());
2020 }
2121
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+
2233 public function testServiceMake ()
2334 {
2435 $ client = Mockery::mock ('PulkitJalan\Google\Client ' , [[]])->makePartial ();
You can’t perform that action at this time.
0 commit comments