ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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 
72  #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
73  public function testTurnedOffWithPostCondition(LSItem $object): void
74  {
75  $this->expectException(LogicException::class);
76  $object->withPostCondition($this->post_condition);
77  }
78 
79  #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
80  public function testTurnedOffWithOrderNumber(LSItem $object): void
81  {
82  $this->expectException(LogicException::class);
83  $object->withOrderNumber(self::ORDER_NUMBER);
84  }
85 
86  #[\PHPUnit\Framework\Attributes\Depends('testCreate')]
87  public function testTurnedOffWithOnline(LSItem $object): void
88  {
89  $this->expectException(LogicException::class);
90  $object->withOnline(self::IS_ONLINE);
91  }
92 }
testTurnedOffWithPostCondition(LSItem $object)
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)
testTurnedOffWithOnline(LSItem $object)
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.