diff options
Diffstat (limited to 'main/app/sprinkles/account/tests')
-rw-r--r-- | main/app/sprinkles/account/tests/Unit/FactoriesTest.php | 60 | ||||
-rw-r--r-- | main/app/sprinkles/account/tests/Unit/HasherTest.php | 138 |
2 files changed, 99 insertions, 99 deletions
diff --git a/main/app/sprinkles/account/tests/Unit/FactoriesTest.php b/main/app/sprinkles/account/tests/Unit/FactoriesTest.php index 84b3cd6..c2377dd 100644 --- a/main/app/sprinkles/account/tests/Unit/FactoriesTest.php +++ b/main/app/sprinkles/account/tests/Unit/FactoriesTest.php @@ -1,30 +1,30 @@ -<?php -/** - * UserFrosting (http://www.userfrosting.com) - * - * @link https://github.com/userfrosting/UserFrosting - * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License) - */ - -namespace UserFrosting\Tests\Unit; - -use UserFrosting\Tests\TestCase; -use UserFrosting\Tests\DatabaseTransactions; - -/** - * FactoriesTest class. - * Tests the factories defined in this sprinkle are working - * - * @extends TestCase - */ -class FactoriesTest extends TestCase -{ - use DatabaseTransactions; - - function testUserFactory() { - $fm = $this->ci->factory; - - $user = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\User'); - $this->assertInstanceOf('UserFrosting\Sprinkle\Account\Database\Models\User', $user); - } -} +<?php
+/**
+ * UserFrosting (http://www.userfrosting.com)
+ *
+ * @link https://github.com/userfrosting/UserFrosting
+ * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
+ */
+
+namespace UserFrosting\Tests\Unit;
+
+use UserFrosting\Tests\TestCase;
+use UserFrosting\Tests\DatabaseTransactions;
+
+/**
+ * FactoriesTest class.
+ * Tests the factories defined in this sprinkle are working
+ *
+ * @extends TestCase
+ */
+class FactoriesTest extends TestCase
+{
+ use DatabaseTransactions;
+
+ function testUserFactory() {
+ $fm = $this->ci->factory;
+
+ $user = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\User');
+ $this->assertInstanceOf('UserFrosting\Sprinkle\Account\Database\Models\User', $user);
+ }
+}
diff --git a/main/app/sprinkles/account/tests/Unit/HasherTest.php b/main/app/sprinkles/account/tests/Unit/HasherTest.php index 95ce270..63c6cd5 100644 --- a/main/app/sprinkles/account/tests/Unit/HasherTest.php +++ b/main/app/sprinkles/account/tests/Unit/HasherTest.php @@ -1,69 +1,69 @@ -<?php -/** - * UserFrosting (http://www.userfrosting.com) - * - * @link https://github.com/userfrosting/UserFrosting - * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License) - */ - -namespace UserFrosting\Tests\Unit; - -use UserFrosting\Sprinkle\Account\Authenticate\Hasher; -use UserFrosting\Tests\TestCase; - -/** - * Tests the password Hasher class. - * - * @extends TestCase - */ -class HasherTest extends TestCase -{ - protected $plainText = 'hodleth'; - - /** - * @var string Legacy hash from UserCake (sha1) - */ - protected $userCakeHash = '87e995bde9ebdc73fc58cc75a9fadc4ae630d8207650fbe94e148ccc8058d5de5'; - - /** - * @var string Legacy hash from UF 0.1.x - */ - protected $legacyHash = '$2y$12$rsXGznS5Ky23lX9iNzApAuDccKRhQFkiy5QfKWp0ACyDWBPOylPB.rsXGznS5Ky23lX9iNzApA9'; - - /** - * @var string Modern hash that uses password_hash() - */ - protected $modernHash = '$2y$10$ucxLwloFso6wJoct1baBQefdrttws/taEYvavi6qoPsw/vd1u4Mha'; - - public function testGetHashType() { - $hasher = new Hasher; - - $type = $hasher->getHashType($this->modernHash); - - $this->assertEquals('modern', $type); - - $type = $hasher->getHashType($this->legacyHash); - - $this->assertEquals('legacy', $type); - - $type = $hasher->getHashType($this->userCakeHash); - - $this->assertEquals('sha1', $type); - } - - public function testVerify() { - $hasher = new Hasher; - - $this->assertTrue($hasher->verify($this->plainText, $this->modernHash)); - $this->assertTrue($hasher->verify($this->plainText, $this->legacyHash)); - $this->assertTrue($hasher->verify($this->plainText, $this->userCakeHash)); - } - - public function testVerifyReject() { - $hasher = new Hasher; - - $this->assertFalse($hasher->verify('selleth', $this->modernHash)); - $this->assertFalse($hasher->verify('selleth', $this->legacyHash)); - $this->assertFalse($hasher->verify('selleth', $this->userCakeHash)); - } -} +<?php
+/**
+ * UserFrosting (http://www.userfrosting.com)
+ *
+ * @link https://github.com/userfrosting/UserFrosting
+ * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
+ */
+
+namespace UserFrosting\Tests\Unit;
+
+use UserFrosting\Sprinkle\Account\Authenticate\Hasher;
+use UserFrosting\Tests\TestCase;
+
+/**
+ * Tests the password Hasher class.
+ *
+ * @extends TestCase
+ */
+class HasherTest extends TestCase
+{
+ protected $plainText = 'hodleth';
+
+ /**
+ * @var string Legacy hash from UserCake (sha1)
+ */
+ protected $userCakeHash = '87e995bde9ebdc73fc58cc75a9fadc4ae630d8207650fbe94e148ccc8058d5de5';
+
+ /**
+ * @var string Legacy hash from UF 0.1.x
+ */
+ protected $legacyHash = '$2y$12$rsXGznS5Ky23lX9iNzApAuDccKRhQFkiy5QfKWp0ACyDWBPOylPB.rsXGznS5Ky23lX9iNzApA9';
+
+ /**
+ * @var string Modern hash that uses password_hash()
+ */
+ protected $modernHash = '$2y$10$ucxLwloFso6wJoct1baBQefdrttws/taEYvavi6qoPsw/vd1u4Mha';
+
+ public function testGetHashType() {
+ $hasher = new Hasher;
+
+ $type = $hasher->getHashType($this->modernHash);
+
+ $this->assertEquals('modern', $type);
+
+ $type = $hasher->getHashType($this->legacyHash);
+
+ $this->assertEquals('legacy', $type);
+
+ $type = $hasher->getHashType($this->userCakeHash);
+
+ $this->assertEquals('sha1', $type);
+ }
+
+ public function testVerify() {
+ $hasher = new Hasher;
+
+ $this->assertTrue($hasher->verify($this->plainText, $this->modernHash));
+ $this->assertTrue($hasher->verify($this->plainText, $this->legacyHash));
+ $this->assertTrue($hasher->verify($this->plainText, $this->userCakeHash));
+ }
+
+ public function testVerifyReject() {
+ $hasher = new Hasher;
+
+ $this->assertFalse($hasher->verify('selleth', $this->modernHash));
+ $this->assertFalse($hasher->verify('selleth', $this->legacyHash));
+ $this->assertFalse($hasher->verify('selleth', $this->userCakeHash));
+ }
+}
|