PHP Classes

File: tests/unit/User/Rule/IsloggedinTest.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   tests/unit/User/Rule/IsloggedinTest.php   Download  
File: tests/unit/User/Rule/IsloggedinTest.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 8 years ago
Size: 696 bytes
 

Contents

Class file image Download
<?php
include_once dirname(__FILE__) . '/../UserMock.php';

class
User_Rule_IsLoggedInTest extends UnitTestCase {
   
    function
setUp() {
    }
   
    function
TearDown() {
    }
   
    function
testUser_Rule_IsLoggedIn() {
       
$level = 5;
       
$errorMsg = 'error';
       
$rule = new A_User_Rule_Isloggedin($errorMsg);
       
       
$user = new UserMock();
       
       
$this->assertFalse($rule->isValid($user));
       
$this->assertFalse($rule->setUser($user)->isValid());
       
$this->assertEqual($rule->getErrorMsg(), $errorMsg);
       
       
$user->setLoggedIn(true);
       
$this->assertTrue($rule->isValid($user));
       
$this->assertTrue($rule->setUser($user)->isValid());
       
$this->assertEqual($rule->getErrorMsg(), '');
    }
   
}