2008-05-14 09:18:12 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class MultiFormSessionTest extends SapphireTest {
|
|
|
|
|
2008-05-14 13:09:47 +02:00
|
|
|
/**
|
|
|
|
* Set up the instance of MultiFormSession, writing
|
|
|
|
* a record to the database for this test. We persist
|
|
|
|
* the object in our tests by assigning $this->session
|
|
|
|
*/
|
|
|
|
function setUp() {
|
|
|
|
$this->session = new MultiFormSession();
|
|
|
|
$this->session->write();
|
|
|
|
}
|
|
|
|
|
2008-05-14 09:18:12 +02:00
|
|
|
/**
|
|
|
|
* Test generation of a new session.
|
2008-05-14 13:09:47 +02:00
|
|
|
*
|
|
|
|
* @TODO Write some more advanced tests for MultiFormSession.
|
2008-05-14 09:18:12 +02:00
|
|
|
*/
|
|
|
|
function testSessionGeneration() {
|
2008-05-14 13:09:47 +02:00
|
|
|
$this->assertTrue($this->session->ID != 0);
|
|
|
|
$this->assertTrue($this->session->ID > 0);
|
2008-05-14 09:18:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test that a MemberID was set on MultiFormSession if
|
|
|
|
* a member is logged in.
|
|
|
|
*/
|
|
|
|
function testMemberLogging() {
|
|
|
|
$session = new MultiFormSession();
|
|
|
|
$session->write();
|
|
|
|
|
|
|
|
if($memberID = Member::currentUserID()) {
|
2008-05-23 07:47:07 +02:00
|
|
|
$this->assertEquals($memberID, $session->SubmitterID);
|
2008-05-14 09:18:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-14 13:09:47 +02:00
|
|
|
/**
|
|
|
|
* Delete the MultiFormSession record that we created.
|
|
|
|
*/
|
|
|
|
function tearDown() {
|
|
|
|
$this->session->delete();
|
|
|
|
}
|
|
|
|
|
2008-05-14 09:18:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|