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

Unit tests. More...

+ Inheritance diagram for assAnswerSimpleTest:
+ Collaboration diagram for assAnswerSimpleTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test_setGetId_shouldReturnUnchangedId ()
 
 test_setGetAnswertext_shouldReturnUnchangedAnswertext ()
 
 test_setGetPoints_shouldReturnUnchangedPoints ()
 
 test_setGetPoints_shouldReturnUnchangedZeroOnNonNumericInput ()
 
 test_setGetOrder_shouldReturnUnchangedOrder ()
 

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

Member Function Documentation

◆ setUp()

assAnswerSimpleTest::setUp ( )
protected

Definition at line 15 of file assAnswerSimpleTest.php.

References defined.

16  {
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  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ test_instantiateObject_shouldReturnInstance()

assAnswerSimpleTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 26 of file assAnswerSimpleTest.php.

27  {
28  // Arrange
29  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
30 
31  // Act
32  $instance = new ASS_AnswerSimple();
33 
34  $this->assertInstanceOf('ASS_AnswerSimple', $instance);
35  }
Class for simple answers.

◆ test_setGetAnswertext_shouldReturnUnchangedAnswertext()

assAnswerSimpleTest::test_setGetAnswertext_shouldReturnUnchangedAnswertext ( )

Definition at line 52 of file assAnswerSimpleTest.php.

53  {
54  // Arrange
55  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
56  $instance = new ASS_AnswerSimple();
57  $expected = 'The answer, of course, is 42.';
58 
59  // Act
60  $instance->setAnswertext($expected);
61  $actual = $instance->getAnswertext();
62 
63  // Assert
64  $this->assertEquals($expected, $actual);
65  }
Class for simple answers.

◆ test_setGetId_shouldReturnUnchangedId()

assAnswerSimpleTest::test_setGetId_shouldReturnUnchangedId ( )

Definition at line 37 of file assAnswerSimpleTest.php.

38  {
39  // Arrange
40  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
41  $instance = new ASS_AnswerSimple();
42  $expected = 1;
43 
44  // Act
45  $instance->setId($expected);
46  $actual = $instance->getId();
47 
48  // Assert
49  $this->assertEquals($expected, $actual);
50  }
Class for simple answers.

◆ test_setGetOrder_shouldReturnUnchangedOrder()

assAnswerSimpleTest::test_setGetOrder_shouldReturnUnchangedOrder ( )

Definition at line 99 of file assAnswerSimpleTest.php.

100  {
101  // Arrange
102  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
103  $instance = new ASS_AnswerSimple();
104  $expected = 42;
105 
106  // Act
107  $instance->setOrder($expected);
108  $actual = $instance->getOrder();
109 
110  // Assert
111  $this->assertEquals($expected, $actual);
112  }
Class for simple answers.

◆ test_setGetPoints_shouldReturnUnchangedPoints()

assAnswerSimpleTest::test_setGetPoints_shouldReturnUnchangedPoints ( )

Definition at line 67 of file assAnswerSimpleTest.php.

68  {
69  // Arrange
70  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
71  $instance = new ASS_AnswerSimple();
72  $expected = 42;
73 
74  // Act
75  $instance->setPoints($expected);
76  $actual = $instance->getPoints();
77 
78  // Assert
79  $this->assertEquals($expected, $actual);
80  }
Class for simple answers.

◆ test_setGetPoints_shouldReturnUnchangedZeroOnNonNumericInput()

assAnswerSimpleTest::test_setGetPoints_shouldReturnUnchangedZeroOnNonNumericInput ( )

Definition at line 82 of file assAnswerSimpleTest.php.

83  {
84  // Note: We want to get rid of this functionality in the class.
85 
86  // Arrange
87  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
88  $instance = new ASS_AnswerSimple();
89  $expected = 0.0;
90 
91  // Act
92  $instance->setPoints('Günther');
93  $actual = $instance->getPoints();
94 
95  // Assert
96  $this->assertEquals($expected, $actual);
97  }
Class for simple answers.

Field Documentation

◆ $backupGlobals

assAnswerSimpleTest::$backupGlobals = false
protected

Definition at line 13 of file assAnswerSimpleTest.php.


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