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

◆ test_instantiateObject_shouldReturnInstance()

assAnswerSimpleTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 29 of file assAnswerSimpleTest.php.

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

◆ test_setGetAnswertext_shouldReturnUnchangedAnswertext()

assAnswerSimpleTest::test_setGetAnswertext_shouldReturnUnchangedAnswertext ( )

Definition at line 55 of file assAnswerSimpleTest.php.

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

◆ test_setGetId_shouldReturnUnchangedId()

assAnswerSimpleTest::test_setGetId_shouldReturnUnchangedId ( )

Definition at line 40 of file assAnswerSimpleTest.php.

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

◆ test_setGetOrder_shouldReturnUnchangedOrder()

assAnswerSimpleTest::test_setGetOrder_shouldReturnUnchangedOrder ( )

Definition at line 102 of file assAnswerSimpleTest.php.

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

◆ test_setGetPoints_shouldReturnUnchangedPoints()

assAnswerSimpleTest::test_setGetPoints_shouldReturnUnchangedPoints ( )

Definition at line 70 of file assAnswerSimpleTest.php.

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

◆ test_setGetPoints_shouldReturnUnchangedZeroOnNonNumericInput()

assAnswerSimpleTest::test_setGetPoints_shouldReturnUnchangedZeroOnNonNumericInput ( )

Definition at line 85 of file assAnswerSimpleTest.php.

86  {
87  // Note: We want to get rid of this functionality in the class.
88 
89  // Arrange
90  require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
91  $instance = new ASS_AnswerSimple();
92  $expected = 0.0;
93 
94  // Act
95  $instance->setPoints('Günther');
96  $actual = $instance->getPoints();
97 
98  // Assert
99  $this->assertEquals($expected, $actual);
100  }
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: