ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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)
 
 testOrderingElementDefaults ()
 
 testOrderingElementMutation (ilAssOrderingElement $element)
 

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.

References getDatabaseMock(), getIliasMock(), and setGlobalVariable().

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')->willReturn('Test');
46  $this->setGlobalVariable('lng', $lng_mock);
47 
48  $this->setGlobalVariable('ilias', $this->getIliasMock());
49  $this->setGlobalVariable('ilDB', $this->getDatabaseMock());
50  }
setGlobalVariable(string $name, mixed $value)
+ Here is the call graph for this function:

◆ 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 76 of file assOrderingQuestionTest.php.

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

◆ 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)

Definition at line 70 of file assOrderingQuestionTest.php.

References ilAssOrderingElementList\withElements().

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

◆ testOrderingElementMutation()

assOrderingQuestionTest::testOrderingElementMutation ( ilAssOrderingElement  $element)

Definition at line 86 of file assOrderingQuestionTest.php.

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

87  {
88  $original = $element;
89  $val = 21;
90 
91  $element = $original->withRandomIdentifier($val);
92  $this->assertNotEquals($original, $element);
93  $this->assertEquals($val, $element->getRandomIdentifier());
94 
95  $element = $original->withSolutionIdentifier($val);
96  $this->assertNotEquals($original, $element);
97  $this->assertEquals($val, $element->getSolutionIdentifier());
98 
99  $element = $original->withPosition($val);
100  $this->assertNotEquals($original, $element);
101  $this->assertEquals($val, $element->getPosition());
102 
103  $element = $original->withIndentation($val);
104  $this->assertNotEquals($original, $element);
105  $this->assertEquals($val, $element->getIndentation());
106 
107  $val = 'some string';
108  $element = $original->withContent($val);
109  $this->assertNotEquals($original, $element);
110  $this->assertEquals($val, $element->getContent());
111  }
+ 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: