ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
assOrderingQuestionTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for assOrderingQuestionTest:
+ Collaboration diagram for assOrderingQuestionTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 testOrderingElementListDefaults ()
 
 testOrderingElementListMutation (ilAssOrderingElementList $list)
 testOrderingElementListDefaults More...
 
 testOrderingElementDefaults ()
 
 testOrderingElementMutation (ilAssOrderingElement $element)
 testOrderingElementDefaults More...
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from assBaseTestCase
 setUp ()
 
 tearDown ()
 
 getIRSSMock ()
 

Protected Attributes

 $backupGlobals = false
 
- Protected Attributes inherited from assBaseTestCase
Container $dic = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Unit tests

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de

\

Definition at line 26 of file assOrderingQuestionTest.php.

Member Function Documentation

◆ setUp()

assOrderingQuestionTest::setUp ( )
protected

Definition at line 30 of file assOrderingQuestionTest.php.

30  : void
31  {
32  parent::setUp();
33 
34  $ilCtrl_mock = $this->getMockBuilder(ilCtrl::class)
35  ->disableOriginalConstructor()
36  ->getMock();
37  $ilCtrl_mock->method('saveParameter');
38  $ilCtrl_mock->method('saveParameterByClass');
39  $this->setGlobalVariable('ilCtrl', $ilCtrl_mock);
40 
41  $lng_mock = $this->getMockBuilder(ilLanguage::class)
42  ->disableOriginalConstructor()
43  ->onlyMethods(['txt'])
44  ->getMock();
45  $lng_mock->method('txt')->will($this->returnValue('Test'));
46  $this->setGlobalVariable('lng', $lng_mock);
47 
48  $this->setGlobalVariable('ilias', $this->getIliasMock());
49  $this->setGlobalVariable('ilDB', $this->getDatabaseMock());
50  }

◆ test_instantiateObject_shouldReturnInstance()

assOrderingQuestionTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 52 of file assOrderingQuestionTest.php.

52  : void
53  {
54  $instance = new assOrderingQuestion();
55 
56  $this->assertInstanceOf(assOrderingQuestion::class, $instance);
57  }
Class for ordering questions.

◆ testOrderingElementDefaults()

assOrderingQuestionTest::testOrderingElementDefaults ( )

Definition at line 78 of file assOrderingQuestionTest.php.

79  {
80  $element_id = 12;
81  $element = new ilAssOrderingElement($element_id);
82  $this->assertInstanceOf(ilAssOrderingElement::class, $element);
83  $this->assertEquals($element_id, $element->getId());
84  return $element;
85  }

◆ testOrderingElementListDefaults()

assOrderingQuestionTest::testOrderingElementListDefaults ( )

Definition at line 59 of file assOrderingQuestionTest.php.

60  {
61  $question_id = 7;
62  $list = new ilAssOrderingElementList($question_id);
63  $this->assertInstanceOf(ilAssOrderingElementList::class, $list);
64  $this->assertEquals($question_id, $list->getQuestionId());
65  $this->assertEquals([], $list->getElements());
66  return $list;
67  }

◆ testOrderingElementListMutation()

assOrderingQuestionTest::testOrderingElementListMutation ( ilAssOrderingElementList  $list)

testOrderingElementListDefaults

Definition at line 72 of file assOrderingQuestionTest.php.

References ilAssOrderingElementList\withElements().

73  {
74  $original = $list;
75  $this->assertNotEquals($original, $list->withElements([]));
76  }
+ Here is the call graph for this function:

◆ testOrderingElementMutation()

assOrderingQuestionTest::testOrderingElementMutation ( ilAssOrderingElement  $element)

testOrderingElementDefaults

Definition at line 90 of file assOrderingQuestionTest.php.

References ilAssOrderingElement\getRandomIdentifier(), ilAssOrderingElement\withRandomIdentifier(), and ilAssOrderingElement\withSolutionIdentifier().

91  {
92  $original = $element;
93  $val = 21;
94 
95  $element = $original->withRandomIdentifier($val);
96  $this->assertNotEquals($original, $element);
97  $this->assertEquals($val, $element->getRandomIdentifier());
98 
99  $element = $original->withSolutionIdentifier($val);
100  $this->assertNotEquals($original, $element);
101  $this->assertEquals($val, $element->getSolutionIdentifier());
102 
103  $element = $original->withPosition($val);
104  $this->assertNotEquals($original, $element);
105  $this->assertEquals($val, $element->getPosition());
106 
107  $element = $original->withIndentation($val);
108  $this->assertNotEquals($original, $element);
109  $this->assertEquals($val, $element->getIndentation());
110 
111  $val = 'some string';
112  $element = $original->withContent($val);
113  $this->assertNotEquals($original, $element);
114  $this->assertEquals($val, $element->getContent());
115  }
+ Here is the call graph for this function:

Field Documentation

◆ $backupGlobals

assOrderingQuestionTest::$backupGlobals = false
protected

Definition at line 28 of file assOrderingQuestionTest.php.


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