diff --git a/src/Platform/Platform.php b/src/Platform/Platform.php index 648231d1..b2dd67aa 100644 --- a/src/Platform/Platform.php +++ b/src/Platform/Platform.php @@ -150,18 +150,17 @@ public function loggedIn() */ public function authUrl($options) { - return $this->createUrl(self::AUTHORIZE_ENDPOINT . '?' . http_build_query( [ - 'response_type' => 'code', - 'redirect_uri' => $options['redirectUri'] ? $options['redirectUri'] : null, - 'client_id' => $this->_clientId, - 'state' => $options['state'] ? $options['state'] : null, - 'brand_id' => $options['brandId'] ? $options['brandId'] : null, - 'display' => $options['display'] ? $options['display'] : null, - 'prompt' => $options['prompt'] ? $options['prompt'] : null, - 'code_challenge' => $options['code_challenge'] ? $options['code_challenge'] : null, - 'code_challenge_method' => $options['code_challenge_method'] ? $options['code_challenge_method'] : null + 'response_type' => 'code', + 'redirect_uri' => $options['redirectUri'] ? $options['redirectUri'] : null, + 'client_id' => $this->_clientId, + 'state' => array_key_exists('state',$options) ? $options['state'] : null, + 'brand_id' => array_key_exists('brandId',$options) ? $options['brandId'] : null, + 'display' => array_key_exists('display',$options) ? $options['display'] : null, + 'prompt' => array_key_exists('prompt',$options) ? $options['prompt'] : null, + 'code_challenge' => array_key_exists('code_challenge',$options) ? $options['code_challenge'] : null, + 'code_challenge_method' => array_key_exists('code_challenge_method',$options) ? $options['code_challenge_method'] : null ]), [ 'addServer' => 'true' ]); diff --git a/src/Platform/PlatformTest.php b/src/Platform/PlatformTest.php index 5a464c8f..fbd40f85 100644 --- a/src/Platform/PlatformTest.php +++ b/src/Platform/PlatformTest.php @@ -70,6 +70,17 @@ public function testLogout() } + public function testAuthUrl() + { + $sdk = $this->getSDK(); + $url = $sdk->platform()->authUrl(array( + 'redirectUri' => 'foo', + 'state' => 'bar', + 'client_id' => 'baz' + )); + $this->assertEquals( $url, "https://whatever/restapi/oauth/authorize?response_type=code&redirect_uri=foo&client_id=whatever&state=bar" ); + } + public function testApiUrl() { diff --git a/src/Subscription/SubscriptionTest.php b/src/Subscription/SubscriptionTest.php index 50445d87..4ad56ca9 100644 --- a/src/Subscription/SubscriptionTest.php +++ b/src/Subscription/SubscriptionTest.php @@ -8,6 +8,8 @@ use RingCentral\SDK\Subscription\Subscription; use RingCentral\SDK\Test\TestCase; use PubNub\Models\Consumer\PubSub\PNMessageResult; +use PubNub\PNConfiguration; +use PubNub\PubNub; class SubscriptionTest extends TestCase { @@ -288,4 +290,14 @@ public function testKeepPolling() } + public function testGetNullPubnub() + { + $sdk = $this->getSDK(); + $s = $this->createSubscription($sdk); + //$pnconf = new PNConfiguration(); + //$s->_pubnub = new PubNub($pnconf); + $pn = $s->pubnub(); + $this->assertNull($pn); + } + } \ No newline at end of file