summaryrefslogtreecommitdiff
path: root/tests/unit/Security/TUserManagerTest.php
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2014-01-15 19:05:25 +0100
committerFabio Bas <ctrlaltca@gmail.com>2014-01-15 19:05:25 +0100
commit2fdb1e997f030155bd6648f9d72a77ccecda0324 (patch)
treede5d34a1c45bb99fa973e7577969a26cb65155ad /tests/unit/Security/TUserManagerTest.php
parentfa51a0a2e3ce4ec4a82a5d2f53fbd50cfcb16528 (diff)
Removed ?> from tests
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 {
}
-?>