ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
LSLearnerItemTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
25  public const TYPE = "type";
26  public const TITLE = "tile";
27  public const DESC = "description";
28  public const ICON_PATH = "icon_path";
29  public const IS_ONLINE = true;
30  public const ORDER_NUMBER = 10;
31  public const REF_ID = 30;
32  public const USER_ID = 6;
33  public const LP_STATUS = 2;
34  public const AVAILABILITY_STATUS = 3;
35  public const LP_MODE = 3;
36 
38 
39  protected function setUp(): void
40  {
41  $this->post_condition = new ilLSPostCondition(666, 'always');
42  }
43 
44  public function testCreate(): LSLearnerItem
45  {
46  $ls_item = new LSItem(
47  self::TYPE,
48  self::TITLE,
49  self::DESC,
50  self::ICON_PATH,
51  self::IS_ONLINE,
52  self::ORDER_NUMBER,
53  $this->post_condition,
54  self::REF_ID,
55  self::LP_MODE
56  );
57 
58  $object = new LSLearnerItem(
59  self::USER_ID,
60  self::LP_STATUS,
61  self::AVAILABILITY_STATUS,
62  $ls_item
63  );
64 
65  $this->assertEquals(self::USER_ID, $object->getUserId());
66  $this->assertEquals(self::LP_STATUS, $object->getLearningProgressStatus());
67  $this->assertEquals(self::AVAILABILITY_STATUS, $object->getAvailability());
68 
69  return $object;
70  }
71 
75  public function testTurnedOffWithPostCondition(LSItem $object): void
76  {
77  $this->expectException(LogicException::class);
78  $object->withPostCondition($this->post_condition);
79  }
80 
84  public function testTurnedOffWithOrderNumber(LSItem $object): void
85  {
86  $this->expectException(LogicException::class);
87  $object->withOrderNumber(self::ORDER_NUMBER);
88  }
89 
93  public function testTurnedOffWithOnline(LSItem $object): void
94  {
95  $this->expectException(LogicException::class);
96  $object->withOnline(self::IS_ONLINE);
97  }
98 }
testTurnedOffWithPostCondition(LSItem $object)
testCreate
withOrderNumber(int $order_number)
Definition: LSItem.php:110
ilLSPostCondition $post_condition
Data holding class LSItem .
Definition: LSItem.php:24
withPostCondition(ilLSPostCondition $post_condition)
Definition: LSItem.php:117
testTurnedOffWithOrderNumber(LSItem $object)
testCreate
testTurnedOffWithOnline(LSItem $object)
testCreate
A PostCondition does restrict the progression of a user through the learning sequence.
withOnline(bool $online)
Definition: LSItem.php:103
Add learning progress and availability information to the LSItem.