ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
LSSettingsTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
22
26class LSSettingsTest extends TestCase
27{
28 public const TO_OBJ_ID = 10;
29 public const TO_ABSTRACT = "abstract";
30 public const TO_EXTRO = "extro";
31 public const TO_ABSTRACT_IMAGE = "abstract/image/path";
32 public const TO_EXTRO_IMAGE = "extro/image/path";
33 public const TO_MEMBERS_GALLERY = true;
35
36 public function testCreate()
37 {
38 $object = new ilLearningSequenceSettings(
39 self::TO_OBJ_ID,
40 self::TO_ABSTRACT,
41 self::TO_EXTRO,
42 self::TO_ABSTRACT_IMAGE,
43 self::TO_EXTRO_IMAGE,
44 self::TO_MEMBERS_GALLERY,
45 self::TO_MODE
46 );
47
48 $this->assertEquals($object->getObjId(), self::TO_OBJ_ID);
49 $this->assertEquals($object->getAbstract(), self::TO_ABSTRACT);
50 $this->assertEquals($object->getExtro(), self::TO_EXTRO);
51 $this->assertEquals($object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
52 $this->assertEquals($object->getExtroImage(), self::TO_EXTRO_IMAGE);
53 $this->assertEquals($object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
54 $this->assertEquals($object->getMode(), self::TO_MODE);
55
56 return $object;
57 }
58
59 #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
61 {
62 $new_object = $object->withAbstract("teststring");
63
64 $this->assertEquals($object->getObjId(), self::TO_OBJ_ID);
65 $this->assertEquals($object->getAbstract(), self::TO_ABSTRACT);
66 $this->assertEquals($object->getExtro(), self::TO_EXTRO);
67 $this->assertEquals($object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
68 $this->assertEquals($object->getExtroImage(), self::TO_EXTRO_IMAGE);
69 $this->assertEquals($object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
70
71 $this->assertEquals($new_object->getObjId(), self::TO_OBJ_ID);
72 $this->assertEquals($new_object->getAbstract(), "teststring");
73 $this->assertEquals($new_object->getExtro(), self::TO_EXTRO);
74 $this->assertEquals($new_object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
75 $this->assertEquals($new_object->getExtroImage(), self::TO_EXTRO_IMAGE);
76 $this->assertEquals($new_object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
77 }
78
79 #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
81 {
82 $new_object = $object->withExtro("teststring");
83
84 $this->assertEquals($object->getObjId(), self::TO_OBJ_ID);
85 $this->assertEquals($object->getAbstract(), self::TO_ABSTRACT);
86 $this->assertEquals($object->getExtro(), self::TO_EXTRO);
87 $this->assertEquals($object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
88 $this->assertEquals($object->getExtroImage(), self::TO_EXTRO_IMAGE);
89 $this->assertEquals($object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
90
91 $this->assertEquals($new_object->getObjId(), self::TO_OBJ_ID);
92 $this->assertEquals($new_object->getAbstract(), self::TO_ABSTRACT);
93 $this->assertEquals($new_object->getExtro(), "teststring");
94 $this->assertEquals($new_object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
95 $this->assertEquals($new_object->getExtroImage(), self::TO_EXTRO_IMAGE);
96 $this->assertEquals($new_object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
97 }
98
99 #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
101 {
102 $new_object = $object->withAbstractImage("teststring");
103
104 $this->assertEquals($object->getObjId(), self::TO_OBJ_ID);
105 $this->assertEquals($object->getAbstract(), self::TO_ABSTRACT);
106 $this->assertEquals($object->getExtro(), self::TO_EXTRO);
107 $this->assertEquals($object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
108 $this->assertEquals($object->getExtroImage(), self::TO_EXTRO_IMAGE);
109 $this->assertEquals($object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
110
111 $this->assertEquals($new_object->getObjId(), self::TO_OBJ_ID);
112 $this->assertEquals($new_object->getAbstract(), self::TO_ABSTRACT);
113 $this->assertEquals($new_object->getExtro(), self::TO_EXTRO);
114 $this->assertEquals($new_object->getAbstractImage(), "teststring");
115 $this->assertEquals($new_object->getExtroImage(), self::TO_EXTRO_IMAGE);
116 $this->assertEquals($new_object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
117 }
118
119 #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
121 {
122 $new_object = $object->withExtroImage("teststring");
123
124 $this->assertEquals($object->getObjId(), self::TO_OBJ_ID);
125 $this->assertEquals($object->getAbstract(), self::TO_ABSTRACT);
126 $this->assertEquals($object->getExtro(), self::TO_EXTRO);
127 $this->assertEquals($object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
128 $this->assertEquals($object->getExtroImage(), self::TO_EXTRO_IMAGE);
129 $this->assertEquals($object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
130
131 $this->assertEquals($new_object->getObjId(), self::TO_OBJ_ID);
132 $this->assertEquals($new_object->getAbstract(), self::TO_ABSTRACT);
133 $this->assertEquals($new_object->getExtro(), self::TO_EXTRO);
134 $this->assertEquals($new_object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
135 $this->assertEquals($new_object->getExtroImage(), "teststring");
136 $this->assertEquals($new_object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
137 }
138
139 #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
141 {
142 $new_object = $object->withMembersGallery(false);
143
144 $this->assertEquals($object->getObjId(), self::TO_OBJ_ID);
145 $this->assertEquals($object->getAbstract(), self::TO_ABSTRACT);
146 $this->assertEquals($object->getExtro(), self::TO_EXTRO);
147 $this->assertEquals($object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
148 $this->assertEquals($object->getExtroImage(), self::TO_EXTRO_IMAGE);
149 $this->assertEquals($object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
150
151 $this->assertEquals($new_object->getObjId(), self::TO_OBJ_ID);
152 $this->assertEquals($new_object->getAbstract(), self::TO_ABSTRACT);
153 $this->assertEquals($new_object->getExtro(), self::TO_EXTRO);
154 $this->assertEquals($new_object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
155 $this->assertEquals($new_object->getExtroImage(), self::TO_EXTRO_IMAGE);
156 $this->assertEquals($new_object->getMembersGallery(), false);
157 }
158
159 #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
160 public function testWithMode(ilLearningSequenceSettings $object): void
161 {
163
164 $this->assertEquals($object->getMode(), self::TO_MODE);
165 $this->assertEquals($new_object->getMode(), ilLearningSequenceSettings::MODE_LINEAR);
166 }
167}
testWithExtroImage(ilLearningSequenceSettings $object)
testWithExtro(ilLearningSequenceSettings $object)
const TO_MEMBERS_GALLERY
testWithAbstractImage(ilLearningSequenceSettings $object)
testWithMembersGallery(ilLearningSequenceSettings $object)
testWithAbstract(ilLearningSequenceSettings $object)
testWithMode(ilLearningSequenceSettings $object)
Settings for an LSO (like abstract, extro)