ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
assClozeSelectGapTest Class Reference

Unit tests. More...

+ Inheritance diagram for assClozeSelectGapTest:
+ Collaboration diagram for assClozeSelectGapTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 test_newlyInstatiatedObject_shouldReturnTrueOnGetShuffle ()
 test_setType_shouldSetShuffling ()
 test_arrayShuffle_shouldShuffleArray ()
 test_getItemswithShuffle_shouldReturnShuffledItems ()
 test_getItemswithoutShuffle_shouldReturnItemsInOrder ()

Protected Member Functions

 setUp ()

Protected Attributes

 $backupGlobals = FALSE

Detailed Description

Unit tests.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de

Definition at line 11 of file assClozeSelectGapTest.php.

Member Function Documentation

assClozeSelectGapTest::setUp ( )
protected

Definition at line 15 of file assClozeSelectGapTest.php.

{
if (defined('ILIAS_PHPUNIT_CONTEXT'))
{
include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
ilUnitUtil::performInitialisation();
}
else
{
chdir( dirname( __FILE__ ) );
chdir('../../../');
}
}
assClozeSelectGapTest::test_arrayShuffle_shouldShuffleArray ( )

Definition at line 65 of file assClozeSelectGapTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeSelectGap.php';
$instance = new assClozeSelectGap(1); // 1 - select gap
$expected = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
$actual = $instance->arrayShuffle($expected);
$this->assertNotEquals($expected, $actual);
}
assClozeSelectGapTest::test_getItemswithoutShuffle_shouldReturnItemsInOrder ( )

Definition at line 103 of file assClozeSelectGapTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeSelectGap.php';
$instance = new assClozeSelectGap(1); // 1 - select gap
require_once './Modules/TestQuestionPool/classes/class.assAnswerCloze.php';
$item1 = new assAnswerCloze('Bert', 1.0, 0);
$item2 = new assAnswerCloze('Fred', 2.0, 1);
$item3 = new assAnswerCloze('Karl', 4, 2);
$item4 = new assAnswerCloze('Esther', 4, 3);
$instance->addItem($item1);
$instance->addItem($item2);
$instance->addItem($item3);
$instance->addItem($item4);
$instance->setType(false);
$expected = array($item1, $item2, $item3, $item4);
$actual = $instance->getItems();
$this->assertEquals($expected, $actual);
}
assClozeSelectGapTest::test_getItemswithShuffle_shouldReturnShuffledItems ( )

Definition at line 77 of file assClozeSelectGapTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeSelectGap.php';
$instance = new assClozeSelectGap(1); // 1 - select gap
require_once './Modules/TestQuestionPool/classes/class.assAnswerCloze.php';
$item1 = new assAnswerCloze('Bert', 1.0, 0);
$item2 = new assAnswerCloze('Fred', 2.0, 2);
$item3 = new assAnswerCloze('Karl', 4, 1);
$item4 = new assAnswerCloze('Esther', 4, 3);
$instance->addItem($item1);
$instance->addItem($item2);
$instance->addItem($item3);
$instance->addItem($item4);
$instance->setType(true);
$expected = array($item1, $item2, $item3, $item4);
$actual = $instance->getItems();
$this->assertNotEquals($expected, $actual);
}
assClozeSelectGapTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 29 of file assClozeSelectGapTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeSelectGap.php';
// Act
$instance = new assClozeSelectGap(1); // 1 - select gap
$this->assertInstanceOf('assClozeSelectGap', $instance);
}
assClozeSelectGapTest::test_newlyInstatiatedObject_shouldReturnTrueOnGetShuffle ( )

Definition at line 40 of file assClozeSelectGapTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeSelectGap.php';
$instance = new assClozeSelectGap(1); // 1 - select gap
$expected = true;
$actual = $instance->getShuffle();
$this->assertEquals($expected, $actual);
}
assClozeSelectGapTest::test_setType_shouldSetShuffling ( )

Definition at line 52 of file assClozeSelectGapTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeSelectGap.php';
$instance = new assClozeSelectGap(1); // 1 - select gap
$expected = false;
$instance->setType($expected);
$actual = $instance->getShuffle();
$this->assertEquals($expected, $actual);
}

Field Documentation

assClozeSelectGapTest::$backupGlobals = FALSE
protected

Definition at line 13 of file assClozeSelectGapTest.php.


The documentation for this class was generated from the following file: