mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
Added basic test to MultiForm
This commit is contained in:
parent
626c272b6f
commit
f5f93fb10e
33
tests/MultiFormSessionTest.php
Normal file
33
tests/MultiFormSessionTest.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
class MultiFormSessionTest extends SapphireTest {
|
||||
|
||||
/**
|
||||
* Test generation of a new session.
|
||||
*/
|
||||
function testSessionGeneration() {
|
||||
$session = new MultiFormSession();
|
||||
$session->write();
|
||||
|
||||
$this->assertTrue($session->ID != 0);
|
||||
$this->assertTrue($session->ID > 0);
|
||||
|
||||
$session->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()) {
|
||||
$this->assertTrue($memberID == $session->SubmitterID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user