public function testPrepareService() { $client = new TestApiClient(); $service = $client->prepareService(); $this->assertEquals("", $service['scope']); $client->setScopes(array("scope1", "scope2")); $service = $client->prepareService(); $this->assertEquals("scope1 scope2", $service['scope']); $client->setScopes(array("", "scope2")); $service = $client->prepareService(); $this->assertEquals(" scope2", $service['scope']); $client->setClientId('test1'); $client->setRedirectUri('http://localhost/'); $client->setScopes(array("http://test.com", "scope2")); $service = $client->prepareService(); $this->assertEquals("http://test.com scope2", $service['scope']); $this->assertEquals('' . 'https://accounts.google.com/o/oauth2/auth' . '?response_type=code&redirect_uri=http%3A%2F%2Flocalhost%2F' . '&client_id=test1' . '&scope=http%3A%2F%2Ftest.com+scope2&access_type=offline' . '&approval_prompt=force', $client->createAuthUrl()); }