summaryrefslogtreecommitdiff
path: root/tests/unit/Security/TUserTest.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/TUserTest.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/TUserTest.php')
-rw-r--r--tests/unit/Security/TUserTest.php21
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/unit/Security/TUserTest.php b/tests/unit/Security/TUserTest.php
index 6fa337e0..3692b97c 100644
--- a/tests/unit/Security/TUserTest.php
+++ b/tests/unit/Security/TUserTest.php
@@ -32,18 +32,18 @@ class TUserTest extends PHPUnit_Framework_TestCase {
self::assertEquals('Guest', $user->getName());
self::assertEquals(self::$mgr, $user->getManager());
}
-
+
public function testManager() {
$user = new TUser (self::$mgr);
self::assertEquals(self::$mgr, $user->getManager());
}
-
+
public function testName() {
$user = new TUser (self::$mgr);
$user->setName('joe');
self::assertEquals('joe', $user->getName());
}
-
+
public function testIsGuest() {
$user = new TUser (self::$mgr);
$user->setName('John');
@@ -54,7 +54,7 @@ class TUserTest extends PHPUnit_Framework_TestCase {
self::assertTrue($user->getIsGuest());
self::assertEquals(array(),$user->getRoles());
}
-
+
public function testRoles() {
$user=new TUser(self::$mgr);
$user->setRoles(array('Administrator','Writer'));
@@ -62,7 +62,7 @@ class TUserTest extends PHPUnit_Framework_TestCase {
$user->setRoles('Reader,User');
self::assertEquals(array('Reader','User'), $user->getRoles());
}
-
+
public function testIsInRole() {
$user=new TUser(self::$mgr);
$user->setRoles(array('Administrator','Writer'));
@@ -71,7 +71,7 @@ class TUserTest extends PHPUnit_Framework_TestCase {
self::assertTrue($user->IsInRole('Writer'));
self::assertFalse($user->isInRole('Reader'));
}
-
+
public function testSaveToString() {
$user = new TUser (self::$mgr);
$user->setName('John');
@@ -81,20 +81,20 @@ class TUserTest extends PHPUnit_Framework_TestCase {
$assumedState=array ('Name' => 'John', 'IsGuest' => false, 'Roles' => array ('Administrator', 'Writer'));
self::assertEquals(serialize($assumedState), $user->saveToString());
}
-
+
public function testLoadFromString() {
$user = new TUser (self::$mgr);
$user->setName('John');
$user->setIsGuest(false);
$user->setRoles('Administrator, Writer');
$save=$user->saveToString();
-
+
$user2 = new TUser (self::$mgr);
$user2->loadFromString($save);
-
+
self::assertEquals($user, $user2);
}
-
+
/* getState & setState are protected methods, will be tested with other tests.
public function testState() {
throw new PHPUnit_Framework_IncompleteTestError();
@@ -111,4 +111,3 @@ class TUserTest extends PHPUnit_Framework_TestCase {
}
-?>