ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
assKprimChoiceTest Class Reference

Unit tests. More...

+ Inheritance diagram for assKprimChoiceTest:
+ Collaboration diagram for assKprimChoiceTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test_getQuestionType_shouldReturnQuestionType ()
 
 test_getAdditionalTableName_shouldReturnAdditionalTableName ()
 
 test_getAnswerTableName_shouldReturnAnswerTableName ()
 
 test_isValidOptionLabel_shouldReturnTrue ()
 
 test_isObligationPossible_shouldReturnTrue ()
 
 test_isValidAnswerType_shouldReturnTrue ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from assBaseTestCase
 setUp ()
 
 setGlobalVariable ($name, $value)
 
 getGlobalTemplateMock ()
 
 getDatabaseMock ()
 
 getIliasMock ()
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

Unit tests.

Author
Guido Vollbach <gvollbachdatabay.de>

Definition at line 9 of file assKprimChoiceTest.php.

Member Function Documentation

◆ setUp()

assKprimChoiceTest::setUp ( )
protected

Reimplemented from assBaseTestCase.

Definition at line 13 of file assKprimChoiceTest.php.

13 : void
14 {
15 require_once './Modules/TestQuestionPool/classes/class.assKprimChoice.php';
16 require_once './Modules/TestQuestionPool/classes/class.ilAssKprimChoiceAnswer.php';
17 if (defined('ILIAS_PHPUNIT_CONTEXT')) {
18 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
19 ilUnitUtil::performInitialisation();
20 } else {
21 chdir(dirname(__FILE__));
22 chdir('../../../');
23 }
24 require_once './Services/Utilities/classes/class.ilUtil.php';
25 }

◆ test_getAdditionalTableName_shouldReturnAdditionalTableName()

assKprimChoiceTest::test_getAdditionalTableName_shouldReturnAdditionalTableName ( )

Definition at line 39 of file assKprimChoiceTest.php.

40 {
41 $obj = new assKprimChoice();
42 $this->assertEquals('qpl_qst_kprim', $obj->getAdditionalTableName());
43 }

◆ test_getAnswerTableName_shouldReturnAnswerTableName()

assKprimChoiceTest::test_getAnswerTableName_shouldReturnAnswerTableName ( )

Definition at line 45 of file assKprimChoiceTest.php.

46 {
47 $obj = new assKprimChoice();
48 $this->assertEquals('qpl_a_kprim', $obj->getAnswerTableName());
49 }

◆ test_getQuestionType_shouldReturnQuestionType()

assKprimChoiceTest::test_getQuestionType_shouldReturnQuestionType ( )

Definition at line 33 of file assKprimChoiceTest.php.

34 {
35 $obj = new assKprimChoice();
36 $this->assertEquals('assKprimChoice', $obj->getQuestionType());
37 }

◆ test_instantiateObject_shouldReturnInstance()

assKprimChoiceTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 27 of file assKprimChoiceTest.php.

28 {
29 $instance = new assKprimChoice();
30 $this->assertInstanceOf('assKprimChoice', $instance);
31 }

◆ test_isObligationPossible_shouldReturnTrue()

assKprimChoiceTest::test_isObligationPossible_shouldReturnTrue ( )

Definition at line 90 of file assKprimChoiceTest.php.

91 {
92 $obj = new assKprimChoice();
93 $this->assertEquals(true, $obj->isObligationPossible(1));
94 }

◆ test_isValidAnswerType_shouldReturnTrue()

assKprimChoiceTest::test_isValidAnswerType_shouldReturnTrue ( )

Definition at line 108 of file assKprimChoiceTest.php.

109 {
110 $obj = new assKprimChoice();
111 $this->assertEquals(false, $obj->isValidAnswerType('not valid'));
112 $this->assertEquals(true, $obj->isValidAnswerType($obj::ANSWER_TYPE_SINGLE_LINE));
113 }

◆ test_isValidOptionLabel_shouldReturnTrue()

assKprimChoiceTest::test_isValidOptionLabel_shouldReturnTrue ( )

Definition at line 83 of file assKprimChoiceTest.php.

84 {
85 $obj = new assKprimChoice();
86 $this->assertEquals(false, $obj->isValidOptionLabel('not valid'));
87 $this->assertEquals(true, $obj->isValidOptionLabel($obj::OPTION_LABEL_RIGHT_WRONG));
88 }

Field Documentation

◆ $backupGlobals

assKprimChoiceTest::$backupGlobals = false
protected

Definition at line 11 of file assKprimChoiceTest.php.


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