public function testRemove()
 {
     $sessionKey = 'Arch.Session.Remove.Test';
     $message = 'Test Removed String';
     // set the session variable and check success
     $returnTest = ArchSessionHandler::set($sessionKey, $message);
     $this->assertTrue($returnTest);
     // remove the session variable and check the return value is the same as the original
     $returnTest = ArchSessionHandler::remove($sessionKey);
     $this->assertEquals($message, $returnTest);
     // assert that the session variable no longer exists (should return false if not found)
     $returnTest = ArchSessionHandler::get($sessionKey);
     $this->assertFalse($returnTest);
 }
Exemplo n.º 2
0
<?php

require_once 'Classes/ArchSessionHandler.php';
// Basic example of class usage
// checks if a session exists - sets one if it doesn't
ArchSessionHandler::checkSession();
$sessionArrayKey = 'Arch.Session.Handler.Array';
$sessionArrayMessage = array('Arch Session Variable One', 'Arch Session Variable Two');
$sessionStringKey = 'Arch.Session.Handler.String';
$sessionStringMessage = 'Arch Session Handler String Message';
// set the session array variable
ArchSessionHandler::set($sessionArrayKey, $sessionArrayMessage);
//set the session string variable
ArchSessionHandler::set($sessionStringKey, $sessionStringMessage);
?>
<!DOCTYPE html>
<html>
<head>
  <title>ArchSessionArrayClass</title>
  <style>
    pre { background-color: lightgray; }
    .comment { color: gray; }
    .string { color: darkgreen; }
    .array, .bool { color: darkblue; }
  </style>
</head>
<body>
  <h1>ArchSessionHandler class - Basic example</h1>
  <hr />
  <h2>Array Example</h2>
  <p class="comment">// assigns an array to the session variable by the key name</p>