ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
assClozeTestTest Class Reference

Unit tests. More...

+ Inheritance diagram for assClozeTestTest:
+ Collaboration diagram for assClozeTestTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 test_cleanQuestionText_shouldReturnCleanedText ()
 test_isComplete_shouldReturnFalseIfIncomplete ()
 test_setGetStartTag_shouldReturnValueUnchanged ()
 test_setGetStartTag_defaultShoulBeApplied ()
 test_setGetEndTag_shouldReturnValueUnchanged ()
 test_setGetEndTag_defaultShoulBeApplied ()
 test_getQuestionType_shouldReturnQuestionType ()
 test_setGetIdenticalScoring_shouldReturnValueUnchanged ()
 test_getAdditionalTableName_shouldReturnAdditionalTableName ()
 test_getAnswerTableName_shouldReturnAnswerTableName ()
 test_setGetFixedTextLength_shouldReturnValueUnchanged ()

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 assClozeTestTest.php.

Member Function Documentation

assClozeTestTest::setUp ( )
protected

Definition at line 15 of file assClozeTestTest.php.

References $ilCtrl, and $lng.

{
if (defined('ILIAS_PHPUNIT_CONTEXT'))
{
include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
ilUnitUtil::performInitialisation();
}
else
{
chdir( dirname( __FILE__ ) );
chdir('../../../');
require_once './Services/UICore/classes/class.ilCtrl.php';
$ilCtrl_mock = $this->getMock('ilCtrl');
$ilCtrl_mock->expects( $this->any() )->method( 'saveParameter' );
$ilCtrl_mock->expects( $this->any() )->method( 'saveParameterByClass' );
global $ilCtrl;
$ilCtrl = $ilCtrl_mock;
require_once './Services/Language/classes/class.ilLanguage.php';
$lng_mock = $this->getMock('ilLanguage', array('txt'), array(), '', false);
//$lng_mock->expects( $this->once() )->method( 'txt' )->will( $this->returnValue('Test') );
global $lng;
$lng = $lng_mock;
$ilias_mock = new stdClass();
$ilias_mock->account = new stdClass();
$ilias_mock->account->id = 6;
$ilias_mock->account->fullname = 'Esther Tester';
global $ilias;
$ilias = $ilias_mock;
}
}
assClozeTestTest::test_cleanQuestionText_shouldReturnCleanedText ( )

Definition at line 60 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
$instance = new assClozeTest();
$in_text = 'Ein <gap>Männlein</gap> steht <gap id="Walter">im</gap> <b>Walde</b> ganz <gap 2>still</gap> und [gap]stumm[/gap]<hr />';
$expected = 'Ein [gap]Männlein[/gap] steht [gap]im[/gap] <b>Walde</b> ganz [gap]still[/gap] und [gap]stumm[/gap]<hr />';
$actual = $instance->cleanQuestiontext($in_text);
$this->assertEquals($expected, $actual);
}
assClozeTestTest::test_getAdditionalTableName_shouldReturnAdditionalTableName ( )

Definition at line 172 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
$instance = new assClozeTest();
$expected = 'qpl_qst_cloze';
$actual = $instance->getAdditionalTableName();
$this->assertEquals($expected, $actual);
}
assClozeTestTest::test_getAnswerTableName_shouldReturnAnswerTableName ( )

Definition at line 184 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
$instance = new assClozeTest();
$expected = 'qpl_a_cloze';
$actual = $instance->getAnswerTableName();
$this->assertEquals($expected, $actual);
}
assClozeTestTest::test_getQuestionType_shouldReturnQuestionType ( )

Definition at line 147 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
$instance = new assClozeTest();
$expected = 'assClozeTest';
$actual = $instance->getQuestionType();
$this->assertEquals($expected, $actual);
}
assClozeTestTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 49 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
// Act
$instance = new assClozeTest();
$this->assertInstanceOf('assClozeTest', $instance);
}
assClozeTestTest::test_isComplete_shouldReturnFalseIfIncomplete ( )

Definition at line 73 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
$instance = new assClozeTest();
$expected = false;
$actual = $instance->isComplete();
$this->assertEquals($expected, $actual);
}
assClozeTestTest::test_setGetEndTag_defaultShoulBeApplied ( )

Definition at line 129 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
$instance = new assClozeTest();
$alternate_tag = '</gappo_the_great>';
$expected = '[/gap]';
$instance->setEndTag($alternate_tag);
$intermediate = $instance->getEndTag();
$this->assertEquals($alternate_tag, $intermediate);
$instance->setEndTag();
$actual = $instance->getEndTag();
$this->assertEquals($expected, $actual);
}
assClozeTestTest::test_setGetEndTag_shouldReturnValueUnchanged ( )

Definition at line 116 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
$instance = new assClozeTest();
$expected = '</gappo_the_great>';
$instance->setEndTag($expected);
$actual = $instance->getEndTag();
$this->assertEquals($expected, $actual);
}
assClozeTestTest::test_setGetFixedTextLength_shouldReturnValueUnchanged ( )

Definition at line 196 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
$instance = new assClozeTest();
$expected = 123;
$instance->setFixedTextLength($expected);
$actual = $instance->getFixedTextLength();
$this->assertEquals($expected, $actual);
}
assClozeTestTest::test_setGetIdenticalScoring_shouldReturnValueUnchanged ( )

Definition at line 159 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
$instance = new assClozeTest();
$expected = 1;
$instance->setIdenticalScoring(true);
$actual = $instance->getIdenticalScoring();
$this->assertEquals($expected, $actual);
}
assClozeTestTest::test_setGetStartTag_defaultShoulBeApplied ( )

Definition at line 98 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
$instance = new assClozeTest();
$alternate_tag = '<gappo_the_great>';
$expected = '[gap]';
$instance->setStartTag($alternate_tag);
$intermediate = $instance->getStartTag();
$this->assertEquals($alternate_tag, $intermediate);
$instance->setStartTag();
$actual = $instance->getStartTag();
$this->assertEquals($expected, $actual);
}
assClozeTestTest::test_setGetStartTag_shouldReturnValueUnchanged ( )

Definition at line 85 of file assClozeTestTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
$instance = new assClozeTest();
$expected = '<gappo_the_great>';
$instance->setStartTag($expected);
$actual = $instance->getStartTag();
$this->assertEquals($expected, $actual);
}

Field Documentation

assClozeTestTest::$backupGlobals = FALSE
protected

Definition at line 13 of file assClozeTestTest.php.


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