From 44c2ff5b079896c0cec9985bf8d6bff7245c57cb Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 27 Feb 2017 16:47:20 -0500 Subject: [PATCH] Speed up tests by only hashing passwords when needed --- tests/User/TestUser.php | 18 +++++++++--------- tests/User/TestUserExternal.php | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/User/TestUser.php b/tests/User/TestUser.php index 3335df35..8478de87 100644 --- a/tests/User/TestUser.php +++ b/tests/User/TestUser.php @@ -32,29 +32,29 @@ class TestUser extends \PHPUnit\Framework\TestCase { } function testAddAUser() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->assertCount(1,$this->data->user->list()); } function testCheckIfAUserDoesExist() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->assertTrue($this->data->user->exists(self::USER1)); } function testAddADuplicateUser() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->assertException("alreadyExists", "User"); - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); } function testAddMultipleUsers() { - $this->data->user->add(self::USER1, "secret"); - $this->data->user->add(self::USER2, "secret"); + $this->data->user->add(self::USER1, ""); + $this->data->user->add(self::USER2, ""); $this->assertCount(2,$this->data->user->list()); } function testRemoveAUser() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->assertCount(1,$this->data->user->list()); $this->data->user->remove(self::USER1); $this->assertCount(0,$this->data->user->list()); @@ -118,12 +118,12 @@ class TestUser extends \PHPUnit\Framework\TestCase { } function testGetTheRightsOfAUser() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->assertEquals(User\Driver::RIGHTS_NONE, $this->data->user->rightsGet(self::USER1)); } function testSetTheRightsOfAUser() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->data->user->rightsSet(self::USER1, User\Driver::RIGHTS_GLOBAL_ADMIN); $this->assertEquals(User\Driver::RIGHTS_GLOBAL_ADMIN, $this->data->user->rightsGet(self::USER1)); } diff --git a/tests/User/TestUserExternal.php b/tests/User/TestUserExternal.php index 8dccd807..f5f4847c 100644 --- a/tests/User/TestUserExternal.php +++ b/tests/User/TestUserExternal.php @@ -33,29 +33,29 @@ class TestUserExternal extends \PHPUnit\Framework\TestCase { } function testAddAUser() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->assertCount(1,$this->data->user->list()); } function testCheckIfAUserDoesExist() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->assertTrue($this->data->user->exists(self::USER1)); } function testAddADuplicateUser() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->assertException("alreadyExists", "User"); - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); } function testAddMultipleUsers() { - $this->data->user->add(self::USER1, "secret"); - $this->data->user->add(self::USER2, "secret"); + $this->data->user->add(self::USER1, ""); + $this->data->user->add(self::USER2, ""); $this->assertCount(2,$this->data->user->list()); } function testRemoveAUser() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->assertCount(1,$this->data->user->list()); $this->data->user->remove(self::USER1); $this->assertCount(0,$this->data->user->list()); @@ -119,12 +119,12 @@ class TestUserExternal extends \PHPUnit\Framework\TestCase { } function testGetTheRightsOfAUser() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->assertEquals(User\Driver::RIGHTS_NONE, $this->data->user->rightsGet(self::USER1)); } function testSetTheRightsOfAUser() { - $this->data->user->add(self::USER1, "secret"); + $this->data->user->add(self::USER1, ""); $this->data->user->rightsSet(self::USER1, User\Driver::RIGHTS_GLOBAL_ADMIN); $this->assertEquals(User\Driver::RIGHTS_GLOBAL_ADMIN, $this->data->user->rightsGet(self::USER1)); }