fix test constant
This commit is contained in:
parent
65337bc9e9
commit
83071d85e3
1 changed files with 9 additions and 8 deletions
|
@ -10,6 +10,7 @@ use Utopia\Database\Role;
|
||||||
use Utopia\Database\Validator\Authorization;
|
use Utopia\Database\Validator\Authorization;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Utopia\Database\Database;
|
use Utopia\Database\Database;
|
||||||
|
use Utopia\Database\Validator\Roles;
|
||||||
|
|
||||||
class AuthTest extends TestCase
|
class AuthTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -379,8 +380,8 @@ class AuthTest extends TestCase
|
||||||
$this->assertCount(11, $roles);
|
$this->assertCount(11, $roles);
|
||||||
$this->assertContains(Role::users()->toString(), $roles);
|
$this->assertContains(Role::users()->toString(), $roles);
|
||||||
$this->assertContains(Role::user(ID::custom('123'))->toString(), $roles);
|
$this->assertContains(Role::user(ID::custom('123'))->toString(), $roles);
|
||||||
$this->assertContains(Role::users(Database::DIMENSION_VERIFIED)->toString(), $roles);
|
$this->assertContains(Role::users(Roles::DIMENSION_VERIFIED)->toString(), $roles);
|
||||||
$this->assertContains(Role::user(ID::custom('123'), Database::DIMENSION_VERIFIED)->toString(), $roles);
|
$this->assertContains(Role::user(ID::custom('123'), Roles::DIMENSION_VERIFIED)->toString(), $roles);
|
||||||
$this->assertContains(Role::team(ID::custom('abc'))->toString(), $roles);
|
$this->assertContains(Role::team(ID::custom('abc'))->toString(), $roles);
|
||||||
$this->assertContains(Role::team(ID::custom('abc'), 'administrator')->toString(), $roles);
|
$this->assertContains(Role::team(ID::custom('abc'), 'administrator')->toString(), $roles);
|
||||||
$this->assertContains(Role::team(ID::custom('abc'), 'moderator')->toString(), $roles);
|
$this->assertContains(Role::team(ID::custom('abc'), 'moderator')->toString(), $roles);
|
||||||
|
@ -394,15 +395,15 @@ class AuthTest extends TestCase
|
||||||
$user['phoneVerification'] = false;
|
$user['phoneVerification'] = false;
|
||||||
|
|
||||||
$roles = Auth::getRoles($user);
|
$roles = Auth::getRoles($user);
|
||||||
$this->assertContains(Role::users(Database::DIMENSION_UNVERIFIED)->toString(), $roles);
|
$this->assertContains(Role::users(Roles::DIMENSION_UNVERIFIED)->toString(), $roles);
|
||||||
$this->assertContains(Role::user(ID::custom('123'), Database::DIMENSION_UNVERIFIED)->toString(), $roles);
|
$this->assertContains(Role::user(ID::custom('123'), Roles::DIMENSION_UNVERIFIED)->toString(), $roles);
|
||||||
|
|
||||||
// Enable single verification type
|
// Enable single verification type
|
||||||
$user['emailVerification'] = true;
|
$user['emailVerification'] = true;
|
||||||
|
|
||||||
$roles = Auth::getRoles($user);
|
$roles = Auth::getRoles($user);
|
||||||
$this->assertContains(Role::users(Database::DIMENSION_VERIFIED)->toString(), $roles);
|
$this->assertContains(Role::users(Roles::DIMENSION_VERIFIED)->toString(), $roles);
|
||||||
$this->assertContains(Role::user(ID::custom('123'), Database::DIMENSION_VERIFIED)->toString(), $roles);
|
$this->assertContains(Role::user(ID::custom('123'), Roles::DIMENSION_VERIFIED)->toString(), $roles);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPrivilegedUserRoles(): void
|
public function testPrivilegedUserRoles(): void
|
||||||
|
@ -438,8 +439,8 @@ class AuthTest extends TestCase
|
||||||
$this->assertCount(7, $roles);
|
$this->assertCount(7, $roles);
|
||||||
$this->assertNotContains(Role::users()->toString(), $roles);
|
$this->assertNotContains(Role::users()->toString(), $roles);
|
||||||
$this->assertNotContains(Role::user(ID::custom('123'))->toString(), $roles);
|
$this->assertNotContains(Role::user(ID::custom('123'))->toString(), $roles);
|
||||||
$this->assertNotContains(Role::users(Database::DIMENSION_VERIFIED)->toString(), $roles);
|
$this->assertNotContains(Role::users(Roles::DIMENSION_VERIFIED)->toString(), $roles);
|
||||||
$this->assertNotContains(Role::user(ID::custom('123'), Database::DIMENSION_VERIFIED)->toString(), $roles);
|
$this->assertNotContains(Role::user(ID::custom('123'), Roles::DIMENSION_VERIFIED)->toString(), $roles);
|
||||||
$this->assertContains(Role::team(ID::custom('abc'))->toString(), $roles);
|
$this->assertContains(Role::team(ID::custom('abc'))->toString(), $roles);
|
||||||
$this->assertContains(Role::team(ID::custom('abc'), 'administrator')->toString(), $roles);
|
$this->assertContains(Role::team(ID::custom('abc'), 'administrator')->toString(), $roles);
|
||||||
$this->assertContains(Role::team(ID::custom('abc'), 'moderator')->toString(), $roles);
|
$this->assertContains(Role::team(ID::custom('abc'), 'moderator')->toString(), $roles);
|
||||||
|
|
Loading…
Reference in a new issue