Skip to content

Commit

Permalink
cleaned up code
Browse files Browse the repository at this point in the history
  • Loading branch information
gaokevin1 committed Dec 27, 2024
1 parent e2ea284 commit 1ac0689
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/SDK/Management/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ public function __construct(API $api)
* @return bool True if tenant permissions are valid, false otherwise.
* @throws AuthException If JWT response is invalid.
*/
public function validateTenantPermissions(array $jwtResponse, string $tenant = '', array $permissions): bool
public function validateTenantPermissions(array $jwtResponse, array $permissions, ?string $tenant = null): bool
{
$tenant = $tenant ?? '';

if (!is_array($permissions)) {
$permissions = [$permissions];
}
Expand Down
14 changes: 9 additions & 5 deletions src/tests/DescopeSDKTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?php

namespace Descope\Tests;

use PHPUnit\Framework\TestCase;
use Descope\SDK\DescopeSDK;
use Descope\SDK\API;
use Descope\SDK\Configuration\SDKConfig;
use Descope\SDK\Auth\Password;
use Descope\SDK\Auth\SSO;
use Descope\SDK\Management\Management;

class DescopeSDKTest extends TestCase
final class DescopeSDKTest extends TestCase
{
private $config;
private $sdk;
Expand All @@ -21,9 +25,9 @@ protected function setUp(): void

public function testConstructorInitializesComponents()
{
$this->assertInstanceOf(SDKConfig::class, $this->sdk->password());
$this->assertInstanceOf(SDKConfig::class, $this->sdk->sso());
$this->assertInstanceOf(SDKConfig::class, $this->sdk->management());
$this->assertInstanceOf(Password::class, $this->sdk->password());
$this->assertInstanceOf(SSO::class, $this->sdk->sso());
$this->assertInstanceOf(Management::class, $this->sdk->management());
}

public function testVerifyThrowsExceptionWithoutToken()
Expand Down
3 changes: 0 additions & 3 deletions src/tests/Management/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
use Descope\SDK\DescopeSDK;
use Descope\SDK\Management\Password\UserPassword;
use Descope\SDK\Management\Password\UserPasswordBcrypt;
use Descope\SDK\Management\Password\UserPasswordFirebase;
use Descope\SDK\Management\Password\UserPasswordPbkdf2;
use Descope\SDK\Management\Password\UserPasswordDjango;
use Descope\SDK\Management\User;
use Descope\SDK\Management\AssociatedTenant;
use Descope\SDK\Management\UserObj;
Expand Down

0 comments on commit 1ac0689

Please sign in to comment.