ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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_ONLINE = true;
34 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_ONLINE,
45 self::TO_MEMBERS_GALLERY
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
55 return $object;
56 }
57
58 #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
60 {
61 $new_object = $object->withAbstract("teststring");
62
63 $this->assertEquals($object->getObjId(), self::TO_OBJ_ID);
64 $this->assertEquals($object->getAbstract(), self::TO_ABSTRACT);
65 $this->assertEquals($object->getExtro(), self::TO_EXTRO);
66 $this->assertEquals($object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
67 $this->assertEquals($object->getExtroImage(), self::TO_EXTRO_IMAGE);
68 $this->assertEquals($object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
69
70 $this->assertEquals($new_object->getObjId(), self::TO_OBJ_ID);
71 $this->assertEquals($new_object->getAbstract(), "teststring");
72 $this->assertEquals($new_object->getExtro(), self::TO_EXTRO);
73 $this->assertEquals($new_object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
74 $this->assertEquals($new_object->getExtroImage(), self::TO_EXTRO_IMAGE);
75 $this->assertEquals($new_object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
76 }
77
78 #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
80 {
81 $new_object = $object->withExtro("teststring");
82
83 $this->assertEquals($object->getObjId(), self::TO_OBJ_ID);
84 $this->assertEquals($object->getAbstract(), self::TO_ABSTRACT);
85 $this->assertEquals($object->getExtro(), self::TO_EXTRO);
86 $this->assertEquals($object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
87 $this->assertEquals($object->getExtroImage(), self::TO_EXTRO_IMAGE);
88 $this->assertEquals($object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
89
90 $this->assertEquals($new_object->getObjId(), self::TO_OBJ_ID);
91 $this->assertEquals($new_object->getAbstract(), self::TO_ABSTRACT);
92 $this->assertEquals($new_object->getExtro(), "teststring");
93 $this->assertEquals($new_object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
94 $this->assertEquals($new_object->getExtroImage(), self::TO_EXTRO_IMAGE);
95 $this->assertEquals($new_object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
96 }
97
98 #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
100 {
101 $new_object = $object->withAbstractImage("teststring");
102
103 $this->assertEquals($object->getObjId(), self::TO_OBJ_ID);
104 $this->assertEquals($object->getAbstract(), self::TO_ABSTRACT);
105 $this->assertEquals($object->getExtro(), self::TO_EXTRO);
106 $this->assertEquals($object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
107 $this->assertEquals($object->getExtroImage(), self::TO_EXTRO_IMAGE);
108 $this->assertEquals($object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
109
110 $this->assertEquals($new_object->getObjId(), self::TO_OBJ_ID);
111 $this->assertEquals($new_object->getAbstract(), self::TO_ABSTRACT);
112 $this->assertEquals($new_object->getExtro(), self::TO_EXTRO);
113 $this->assertEquals($new_object->getAbstractImage(), "teststring");
114 $this->assertEquals($new_object->getExtroImage(), self::TO_EXTRO_IMAGE);
115 $this->assertEquals($new_object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
116 }
117
118 #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
120 {
121 $new_object = $object->withExtroImage("teststring");
122
123 $this->assertEquals($object->getObjId(), self::TO_OBJ_ID);
124 $this->assertEquals($object->getAbstract(), self::TO_ABSTRACT);
125 $this->assertEquals($object->getExtro(), self::TO_EXTRO);
126 $this->assertEquals($object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
127 $this->assertEquals($object->getExtroImage(), self::TO_EXTRO_IMAGE);
128 $this->assertEquals($object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
129
130 $this->assertEquals($new_object->getObjId(), self::TO_OBJ_ID);
131 $this->assertEquals($new_object->getAbstract(), self::TO_ABSTRACT);
132 $this->assertEquals($new_object->getExtro(), self::TO_EXTRO);
133 $this->assertEquals($new_object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
134 $this->assertEquals($new_object->getExtroImage(), "teststring");
135 $this->assertEquals($new_object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
136 }
137
138 #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
140 {
141 $new_object = $object->withMembersGallery(false);
142
143 $this->assertEquals($object->getObjId(), self::TO_OBJ_ID);
144 $this->assertEquals($object->getAbstract(), self::TO_ABSTRACT);
145 $this->assertEquals($object->getExtro(), self::TO_EXTRO);
146 $this->assertEquals($object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
147 $this->assertEquals($object->getExtroImage(), self::TO_EXTRO_IMAGE);
148 $this->assertEquals($object->getMembersGallery(), self::TO_MEMBERS_GALLERY);
149
150 $this->assertEquals($new_object->getObjId(), self::TO_OBJ_ID);
151 $this->assertEquals($new_object->getAbstract(), self::TO_ABSTRACT);
152 $this->assertEquals($new_object->getExtro(), self::TO_EXTRO);
153 $this->assertEquals($new_object->getAbstractImage(), self::TO_ABSTRACT_IMAGE);
154 $this->assertEquals($new_object->getExtroImage(), self::TO_EXTRO_IMAGE);
155 $this->assertEquals($new_object->getMembersGallery(), false);
156 }
157}
testWithExtroImage(ilLearningSequenceSettings $object)
testWithExtro(ilLearningSequenceSettings $object)
const TO_MEMBERS_GALLERY
testWithAbstractImage(ilLearningSequenceSettings $object)
testWithMembersGallery(ilLearningSequenceSettings $object)
testWithAbstract(ilLearningSequenceSettings $object)
Settings for an LSO (like abstract, extro)