ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
LSLearnerItemTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
7 
9 {
10  const TYPE = "type";
11  const TITLE = "tile";
12  const DESC = "description";
13  const ICON_PATH = "icon_path";
14  const IS_ONLINE = true;
15  const ORDER_NUMBER = 10;
16  const REF_ID = 30;
17  const USER_ID = 6;
18  const LP_STATUS = 2;
20 
24  protected $post_condition;
25 
26  public function setUp() : void
27  {
28  $this->post_condition = new ilLSPostCondition(666, 'always');
29  }
30 
31  public function testCreate() : LSLearnerItem
32  {
33  $ls_item = new LSItem(
34  self::TYPE,
35  self::TITLE,
36  self::DESC,
37  self::ICON_PATH,
38  self::IS_ONLINE,
39  self::ORDER_NUMBER,
40  $this->post_condition,
41  self::REF_ID
42  );
43 
44  $object = new LSLearnerItem(
45  self::USER_ID,
46  self::LP_STATUS,
47  self::AVAILABILITY_STATUS,
48  $ls_item
49  );
50 
51  $this->assertEquals($object->getUserId(), self::USER_ID);
52  $this->assertEquals($object->getLearningProgressStatus(), self::LP_STATUS);
53  $this->assertEquals($object->getAvailability(), self::AVAILABILITY_STATUS);
54 
55  return $object;
56  }
57 
61  public function testTurnedOffWithPostCondition(LSItem $object)
62  {
63  $this->expectException(LogicException::class);
64  $object->withPostCondition($this->post_condition);
65  }
66 
70  public function testTurnedOffWithOrderNumber(LSItem $object)
71  {
72  $this->expectException(LogicException::class);
73  $object->withOrderNumber(self::ORDER_NUMBER);
74  }
75 
79  public function testTurnedOffWithOnline(LSItem $object)
80  {
81  $this->expectException(LogicException::class);
82  $object->withOnline(self::IS_ONLINE);
83  }
84 }
testTurnedOffWithPostCondition(LSItem $object)
testCreate
withOrderNumber(int $order_number)
Definition: LSItem.php:110
Data holding class LSItem .
Definition: LSItem.php:11
testTurnedOffWithOrderNumber(LSItem $object)
testCreate
testTurnedOffWithOnline(LSItem $object)
testCreate
A PostCondition does restrict the progression of a user through the learning sequence.
withPostCondition(ilLSPostCondition $postcondition)
Definition: LSItem.php:122
withOnline(bool $online)
Definition: LSItem.php:98
Add learning progress and availability information to the LSItem.