ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
assOrderingQuestionTest.php
Go to the documentation of this file.
1 <?php
2 
27 {
28  protected $backupGlobals = false;
29 
30  protected function setUp(): 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  }
51 
53  {
54  $instance = new assOrderingQuestion();
55 
56  $this->assertInstanceOf(assOrderingQuestion::class, $instance);
57  }
58 
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  }
68 
73  {
74  $original = $list;
75  $this->assertNotEquals($original, $list->withElements([]));
76  }
77 
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  }
86 
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  }
116 }
Class assBaseTestCase.
testOrderingElementListMutation(ilAssOrderingElementList $list)
testOrderingElementListDefaults
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class for ordering questions.
testOrderingElementMutation(ilAssOrderingElement $element)
testOrderingElementDefaults