ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
assSingleChoiceTest Class Reference

Unit tests for single choice questions. More...

+ Inheritance diagram for assSingleChoiceTest:
+ Collaboration diagram for assSingleChoiceTest:

Public Member Functions

 test_isComplete_shouldReturnTrue ()
 Create a sample question and save it to the database. More...
 
 test_getThumbPrefix_shouldReturnString ()
 
 test_setOutputType_shouldReturngetOutputType ()
 
 test_getAnswerCount_shouldReturnCount ()
 
 test_flushAnswers_shouldClearAnswers ()
 
 test_getQuestionType_shouldReturnQuestionType ()
 
 test_getAdditionalTableName_shouldReturnAdditionalTableName ()
 
 test_getAnswerTableName_shouldReturnAnswerTableName ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

Unit tests for single choice questions.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
$Id$

Definition at line 13 of file assSingleChoiceTest.php.

Member Function Documentation

◆ setUp()

assSingleChoiceTest::setUp ( )
protected

Definition at line 17 of file assSingleChoiceTest.php.

References defined.

18  {
19  require_once './Modules/TestQuestionPool/classes/class.assSingleChoice.php';
20  if (defined('ILIAS_PHPUNIT_CONTEXT')) {
21  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
22  ilUnitUtil::performInitialisation();
23  } else {
24  chdir(dirname(__FILE__));
25  chdir('../../../');
26  }
27  require_once './Services/Utilities/classes/class.ilUtil.php';
28  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ test_flushAnswers_shouldClearAnswers()

assSingleChoiceTest::test_flushAnswers_shouldClearAnswers ( )

Definition at line 121 of file assSingleChoiceTest.php.

122  {
123  $obj = new assSingleChoice();
124  $obj->addAnswer('1', 1, 0);
125  $obj->addAnswer('1', 1, 1);
126  $this->assertEquals(2, $obj->getAnswerCount());
127  $obj->flushAnswers();
128  $this->assertEquals(0, $obj->getAnswerCount());
129  }
Class for single choice questions.

◆ test_getAdditionalTableName_shouldReturnAdditionalTableName()

assSingleChoiceTest::test_getAdditionalTableName_shouldReturnAdditionalTableName ( )

Definition at line 137 of file assSingleChoiceTest.php.

138  {
139  $obj = new assSingleChoice();
140  $this->assertEquals('qpl_qst_sc', $obj->getAdditionalTableName());
141  }
Class for single choice questions.

◆ test_getAnswerCount_shouldReturnCount()

assSingleChoiceTest::test_getAnswerCount_shouldReturnCount ( )

Definition at line 110 of file assSingleChoiceTest.php.

111  {
112  $obj = new assSingleChoice();
113  $this->assertEquals(0, $obj->getAnswerCount());
114  $obj->addAnswer('1', 1, 0);
115  $obj->addAnswer('1', 1, 1);
116  $this->assertEquals(2, $obj->getAnswerCount());
117  $obj->deleteAnswer(0);
118  $this->assertEquals(1, $obj->getAnswerCount());
119  }
Class for single choice questions.

◆ test_getAnswerTableName_shouldReturnAnswerTableName()

assSingleChoiceTest::test_getAnswerTableName_shouldReturnAnswerTableName ( )

Definition at line 143 of file assSingleChoiceTest.php.

144  {
145  $obj = new assSingleChoice();
146  $this->assertEquals('qpl_a_sc', $obj->getAnswerTableName());
147  }
Class for single choice questions.

◆ test_getQuestionType_shouldReturnQuestionType()

assSingleChoiceTest::test_getQuestionType_shouldReturnQuestionType ( )

Definition at line 131 of file assSingleChoiceTest.php.

132  {
133  $obj = new assSingleChoice();
134  $this->assertEquals('assSingleChoice', $obj->getQuestionType());
135  }
Class for single choice questions.

◆ test_getThumbPrefix_shouldReturnString()

assSingleChoiceTest::test_getThumbPrefix_shouldReturnString ( )

Definition at line 97 of file assSingleChoiceTest.php.

98  {
99  $obj = new assSingleChoice();
100  $this->assertEquals('thumb.', $obj->getThumbPrefix());
101  }
Class for single choice questions.

◆ test_isComplete_shouldReturnTrue()

assSingleChoiceTest::test_isComplete_shouldReturnTrue ( )

Create a sample question and save it to the database.

Parameters
integer$obj_idObject ID of the containing question pool object (optional)
Returns
integer ID of the newly created question Question creation test
Parameters

Definition at line 85 of file assSingleChoiceTest.php.

86  {
87  $obj = new assSingleChoice();
88  $this->assertEquals(false, $obj->isComplete());
89  $obj->setTitle('Tilte');
90  $obj->setAuthor('Me or another');
91  $obj->setQuestion('My great Question.');
92  $obj->addAnswer('Super simple single Choice', 1);
93 
94  $this->assertEquals(true, $obj->isComplete());
95  }
Class for single choice questions.

◆ test_setOutputType_shouldReturngetOutputType()

assSingleChoiceTest::test_setOutputType_shouldReturngetOutputType ( )

Definition at line 103 of file assSingleChoiceTest.php.

104  {
105  $obj = new assSingleChoice();
106  $obj->setOutputType(0);
107  $this->assertEquals(0, $obj->getOutputType());
108  }
Class for single choice questions.

Field Documentation

◆ $backupGlobals

assSingleChoiceTest::$backupGlobals = false
protected

Definition at line 15 of file assSingleChoiceTest.php.


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