ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
22  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
23  ilUnitUtil::performInitialisation();
24  }
25  else
26  {
27  chdir( dirname( __FILE__ ) );
28  chdir('../../../');
29  }
30  require_once './Services/Utilities/classes/class.ilUtil.php';
31  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ test_flushAnswers_shouldClearAnswers()

assSingleChoiceTest::test_flushAnswers_shouldClearAnswers ( )

Definition at line 124 of file assSingleChoiceTest.php.

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

◆ test_getAdditionalTableName_shouldReturnAdditionalTableName()

assSingleChoiceTest::test_getAdditionalTableName_shouldReturnAdditionalTableName ( )

Definition at line 140 of file assSingleChoiceTest.php.

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

◆ test_getAnswerCount_shouldReturnCount()

assSingleChoiceTest::test_getAnswerCount_shouldReturnCount ( )

Definition at line 113 of file assSingleChoiceTest.php.

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

◆ test_getAnswerTableName_shouldReturnAnswerTableName()

assSingleChoiceTest::test_getAnswerTableName_shouldReturnAnswerTableName ( )

Definition at line 146 of file assSingleChoiceTest.php.

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

◆ test_getQuestionType_shouldReturnQuestionType()

assSingleChoiceTest::test_getQuestionType_shouldReturnQuestionType ( )

Definition at line 134 of file assSingleChoiceTest.php.

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

◆ test_getThumbPrefix_shouldReturnString()

assSingleChoiceTest::test_getThumbPrefix_shouldReturnString ( )

Definition at line 100 of file assSingleChoiceTest.php.

101  {
102  $obj = new assSingleChoice();
103  $this->assertEquals('thumb.', $obj->getThumbPrefix());
104  }
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 88 of file assSingleChoiceTest.php.

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

◆ test_setOutputType_shouldReturngetOutputType()

assSingleChoiceTest::test_setOutputType_shouldReturngetOutputType ( )

Definition at line 106 of file assSingleChoiceTest.php.

107  {
108  $obj = new assSingleChoice();
109  $obj->setOutputType(0);
110  $this->assertEquals(0, $obj->getOutputType());
111  }
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: