From 8841da9cbb6c3d9944c9924df28d3bbd043abd91 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Tue, 28 Feb 2017 12:54:48 -0500 Subject: [PATCH] Tweak authorization exception tests --- tests/User/TestAuthorization.php | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tests/User/TestAuthorization.php b/tests/User/TestAuthorization.php index 58a4700d..ff0d14c7 100644 --- a/tests/User/TestAuthorization.php +++ b/tests/User/TestAuthorization.php @@ -251,7 +251,7 @@ class TestAuthorization extends \PHPUnit\Framework\TestCase { } function testInternalExceptionLogic() { - $failTest = [ + $test = [ 'userExists', 'userRemove', 'userAdd', @@ -262,16 +262,10 @@ class TestAuthorization extends \PHPUnit\Framework\TestCase { 'userRightsSet', 'userList', ]; - $passTest = [ - 'userRightsSet', - 'userList' - ]; - sort($failTest); - sort($passTest); - $actor = "user@example.com"; - $this->data->user->auth($actor, ""); - $this->assertEquals($passTest, $this->checkExceptions($actor)); - $this->assertEquals($failTest, $this->checkExceptions("user@example.org")); + $this->data->user->auth("gadm@example.com", ""); + $this->assertCount(0, $this->checkExceptions("user@example.org")); + $this->data->user->auth("user@example.com", ""); + $this->assertCount(sizeof($test), $this->checkExceptions("user@example.org")); } function testExternalExceptionLogic() { @@ -319,7 +313,7 @@ class TestAuthorization extends \PHPUnit\Framework\TestCase { $err[] = "userRightsGet"; } try { - $this->data->user->rightsSet($user, 10000); + $this->data->user->rightsSet($user, User\Driver::RIGHTS_GLOBAL_ADMIN); } catch(User\ExceptionAuthz $e) { $err[] = "userRightsSet"; } @@ -328,7 +322,6 @@ class TestAuthorization extends \PHPUnit\Framework\TestCase { } catch(User\ExceptionAuthz $e) { $err[] = "userList"; } - sort($err); return $err; } } \ No newline at end of file