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); }
<?php /** * Get the session variable with the handle 'Arch.Session.Handler.Array' * Removes the session variable */ print_r(ArchSessionHandler::get($sessionArrayKey)); ?> </pre> <hr /> <h2>String Example</h2> <p class="comment">// sets the session variable and assigns a string value to it</p> <p>ArchSessionHandler::set( <span class="string">'Arch.Session.Handler.String'</span>, <span class="string">'Arch Session Handler String Message'</span> );</p> <p class="comment">// gets the session variable - the second parameter tells the class to keep the session variable in place</p> <p>ArchSessionHandler::get( <span class="string">'Arch.Session.Handler.String'</span>, <span class="bool">false</span>); </p> <p>Output:</p> <pre> <?php /** * Get the session variable with the handle 'Arch.Session.Handler.String' * Keep the session variable in place (2nd parameter) */ echo ArchSessionHandler::get($sessionStringKey, false); ?> </pre> </body> </html>