summaryrefslogtreecommitdiff
path: root/tests/unit/Security/TUserManagerTest.php
diff options
context:
space:
mode:
authorctrlaltca <ctrlaltca@gmail.com>2014-08-26 16:59:21 +0200
committerctrlaltca <ctrlaltca@gmail.com>2014-08-26 16:59:21 +0200
commit74b31be9515eddfa63005d6760614badfaba9fea (patch)
tree47c952901dcb5eccd6dd8b7c6ee7e0b6bf176510 /tests/unit/Security/TUserManagerTest.php
parent2b11341614ac4a15be697fa8acad07055154ac54 (diff)
parent0c5026b55cde5c104f10686afd8b441568175d38 (diff)
Merge pull request #530 from pradosoft/prado-3.2.43.2.4prado-3.2
Backports for Prado 3.2.4
Diffstat (limited to 'tests/unit/Security/TUserManagerTest.php')
-rw-r--r--tests/unit/Security/TUserManagerTest.php31
1 files changed, 15 insertions, 16 deletions
diff --git a/tests/unit/Security/TUserManagerTest.php b/tests/unit/Security/TUserManagerTest.php
index edb7ea6f..91b9d0c6 100644
--- a/tests/unit/Security/TUserManagerTest.php
+++ b/tests/unit/Security/TUserManagerTest.php
@@ -6,18 +6,18 @@ Prado::using('System.Security.TUserManager');
* @package System.Security
*/
class TUserManagerTest extends PHPUnit_Framework_TestCase {
-
+
public static $app=null;
public static $config=null;
-
+
public function setUp() {
-
+
if(self::$app === null) {
self::$app = new TApplication(dirname(__FILE__).'/app');
prado::setPathofAlias('App', dirname(__FILE__));
}
-
+
if (self::$config === null) {
// Simulate a config file
self::$config=new TXmlDocument('1.0','utf8');
@@ -41,21 +41,21 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
$userManager->init (new TXmlDocument()); // Empty config
self::assertEquals(array('joe'=>'demo','john'=>'demo', 'test' => 'test'), $userManager->getUsers());
unlink (dirname(__FILE__).'/users.xml');
- }
+ }
}
-
+
public function testUsers() {
$userManager=new TUserManager ();
$userManager->init (self::$config);
self::assertEquals(array('joe'=>'demo','john'=>'demo', 'test' => 'test'), $userManager->getUsers());
}
-
+
public function testRoles() {
$userManager=new TUserManager ();
$userManager->init (self::$config);
self::assertEquals(array('joe'=>array ('Writer'), 'john'=>array ('Administrator','Writer'), 'test' => array ('Reader', 'User')), $userManager->getRoles());
}
-
+
public function testUserFile() {
$userManager=new TUserManager ();
try {
@@ -71,7 +71,7 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
self::assertEquals(dirname(__FILE__).'/users.xml', $userManager->getUserFile());
unlink (dirname(__FILE__).'/users.xml');
$userManager=null;
- }
+ }
$userManager=new TUserManager ();
$userManager->init (self::$config);
try {
@@ -79,14 +79,14 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
self::fail ('Exception TInvalidOperationException not thrown');
} catch (TInvalidOperationException $e) {}
}
-
+
public function testGuestName() {
$userManager=new TUserManager ();
self::assertEquals('Guest', $userManager->getGuestName());
$userManager->setGuestName('Invite');
self::assertEquals('Invite', $userManager->getGuestName());
}
-
+
public function testPasswordMode() {
$userManager=new TUserManager ();
$userManager->setPasswordMode('Clear');
@@ -99,9 +99,9 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
$userManager->setPasswordMode('Invalid');
self::fail ('Exception TInvalidDataValueException not thrown');
} catch (TInvalidDataValueException $e) {}
-
+
}
-
+
public function testValidateUser() {
$userManager=new TUserManager ();
$userManager->init (self::$config);
@@ -109,7 +109,7 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
self::assertTrue($userManager->validateUser('Joe', 'demo'));
self::assertFalse($userManager->validateUser('John', 'bad'));
}
-
+
public function testUser() {
$userManager=new TUserManager ();
$userManager->init (self::$config);
@@ -123,7 +123,7 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
self::assertFalse($user->getIsGuest());
self::assertNull($userManager->getUser('badUser'));
}
-
+
public function testSwitchToGuest() {
$userManager=new TUserManager ();
$userManager->init (self::$config);
@@ -134,4 +134,3 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
}
-?>