Пример #1
0
 public function testPostGetUrl()
 {
     // should return https://www.soundcloud.com/resolve
     $auth = new Auth("ClientIDHash");
     $resource = new Resource('get', '/resolve');
     $resource->setParams(array('client_id' => $auth->getClientID(), 'url' => 'http://soundcloud.com/matas/hobnotropic'));
     $builder = new UrlBuilder($resource);
     $this->assertEquals("https://api.soundcloud.com/resolve?client_id=ClientIDHash&url=" . "http%3A%2F%2Fsoundcloud.com%2Fmatas%2Fhobnotropic", $builder->getUrl());
 }
Пример #2
0
 public function testMergeParams()
 {
     $auth = new Auth("ClientIDHash", "ClientSecretHash");
     $params = $auth->mergeParams(array(), false);
     $this->assertArrayHasKey("client_id", $params);
     $this->assertArrayNotHasKey("oauth_token", $params);
     $this->assertArrayNotHasKey("client_secret", $params);
     $params = $auth->mergeParams(array(), true);
     $this->assertArrayHasKey("client_secret", $params);
     $this->assertEquals("ClientSecretHash", $params['client_secret']);
     $property = $this->reflectProperty("Njasm\\Soundcloud\\Auth\\Auth", "accessToken");
     $property->setValue($auth, "1-23-456789");
     $params = $auth->mergeParams();
     $this->assertArrayHasKey('oauth_token', $params);
     $this->assertEquals("1-23-456789", $params['oauth_token']);
 }