@@ -120,34 +120,34 @@ public function testAppEngineAutoConfig() {
120120 $ this ->assertInstanceOf ('Google_Cache_Memcache ' , $ client ->getCache ());
121121 unset($ _SERVER ['SERVER_SOFTWARE ' ]);
122122 }
123-
123+
124124 public function testJsonConfig () {
125125 // Device config
126- $ config = new Google_Config ();
127- $ client = new Google_Client ($ config );
128- $ device = '{"installed":{"auth_uri":"https://accounts.google.com/o/oauth2/auth","client_secret":"N0aHCBT1qX1VAcF5J1pJAn6S","token_uri":"https://accounts.google.com/o/oauth2/token","client_email":"","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","oob"],"client_x509_cert_url":"","client_id":"123456789.apps.googleusercontent.com","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs"}} ' ;
129- $ dObj = json_decode ($ device );
130- $ client ->setAuthConfig ($ device );
131- $ cfg = $ config ->getClassConfig ('Google_Auth_OAuth2 ' );
132- $ this ->assertEquals ($ cfg ['client_id ' ], $ dObj ->installed ->client_id );
133- $ this ->assertEquals ($ cfg ['client_secret ' ], $ dObj ->installed ->client_secret );
134- $ this ->assertEquals ($ cfg ['redirect_uri ' ], $ dObj ->installed ->redirect_uris [0 ]);
135-
136- // Web config
137- $ config = new Google_Config ();
138- $ client = new Google_Client ($ config );
139- $ web = '{"web":{"auth_uri":"https://accounts.google.com/o/oauth2/auth","client_secret":"lpoubuib8bj-Fmke_YhhyHGgXc","token_uri":"https://accounts.google.com/o/oauth2/token","client_email":"123456789@developer.gserviceaccount.com","client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/123456789@developer.gserviceaccount.com","client_id":"123456789.apps.googleusercontent.com","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs"}} ' ;
140- $ wObj = json_decode ($ web );
141- $ client ->setAuthConfig ($ web );
142- $ cfg = $ config ->getClassConfig ('Google_Auth_OAuth2 ' );
143- $ this ->assertEquals ($ cfg ['client_id ' ], $ wObj ->web ->client_id );
144- $ this ->assertEquals ($ cfg ['client_secret ' ], $ wObj ->web ->client_secret );
145- $ this ->assertEquals ($ cfg ['redirect_uri ' ], '' );
146- }
147-
148- public function testIniConfig () {
149- $ config = new Google_Config (__DIR__ . "/testdata/test.ini " );
150- $ this ->assertEquals ('My Test application ' , $ config ->getApplicationName ());
151- $ this ->assertEquals ('gjfiwnGinpena3 ' , $ config ->getClassConfig ('Google_Auth_OAuth2 ' , 'client_secret ' ));
152- }
126+ $ config = new Google_Config ();
127+ $ client = new Google_Client ($ config );
128+ $ device = '{"installed":{"auth_uri":"https://accounts.google.com/o/oauth2/auth","client_secret":"N0aHCBT1qX1VAcF5J1pJAn6S","token_uri":"https://accounts.google.com/o/oauth2/token","client_email":"","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","oob"],"client_x509_cert_url":"","client_id":"123456789.apps.googleusercontent.com","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs"}} ' ;
129+ $ dObj = json_decode ($ device );
130+ $ client ->setAuthConfig ($ device );
131+ $ cfg = $ config ->getClassConfig ('Google_Auth_OAuth2 ' );
132+ $ this ->assertEquals ($ cfg ['client_id ' ], $ dObj ->installed ->client_id );
133+ $ this ->assertEquals ($ cfg ['client_secret ' ], $ dObj ->installed ->client_secret );
134+ $ this ->assertEquals ($ cfg ['redirect_uri ' ], $ dObj ->installed ->redirect_uris [0 ]);
135+
136+ // Web config
137+ $ config = new Google_Config ();
138+ $ client = new Google_Client ($ config );
139+ $ web = '{"web":{"auth_uri":"https://accounts.google.com/o/oauth2/auth","client_secret":"lpoubuib8bj-Fmke_YhhyHGgXc","token_uri":"https://accounts.google.com/o/oauth2/token","client_email":"123456789@developer.gserviceaccount.com","client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/123456789@developer.gserviceaccount.com","client_id":"123456789.apps.googleusercontent.com","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs"}} ' ;
140+ $ wObj = json_decode ($ web );
141+ $ client ->setAuthConfig ($ web );
142+ $ cfg = $ config ->getClassConfig ('Google_Auth_OAuth2 ' );
143+ $ this ->assertEquals ($ cfg ['client_id ' ], $ wObj ->web ->client_id );
144+ $ this ->assertEquals ($ cfg ['client_secret ' ], $ wObj ->web ->client_secret );
145+ $ this ->assertEquals ($ cfg ['redirect_uri ' ], '' );
146+ }
147+
148+ public function testIniConfig () {
149+ $ config = new Google_Config (__DIR__ . "/testdata/test.ini " );
150+ $ this ->assertEquals ('My Test application ' , $ config ->getApplicationName ());
151+ $ this ->assertEquals ('gjfiwnGinpena3 ' , $ config ->getClassConfig ('Google_Auth_OAuth2 ' , 'client_secret ' ));
152+ }
153153}
0 commit comments