ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
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 
22 
23 class LSLearnerItemTest extends TestCase
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 
37 
38  protected function setUp(): void
39  {
40  $this->post_condition = new ilLSPostCondition(666, 'always');
41  }
42 
43  public function testCreate(): LSLearnerItem
44  {
45  $ls_item = new LSItem(
46  self::TYPE,
47  self::TITLE,
48  self::DESC,
49  self::ICON_PATH,
50  self::IS_ONLINE,
51  self::ORDER_NUMBER,
52  $this->post_condition,
53  self::REF_ID
54  );
55 
56  $object = new LSLearnerItem(
57  self::USER_ID,
58  self::LP_STATUS,
59  self::AVAILABILITY_STATUS,
60  $ls_item
61  );
62 
63  $this->assertEquals(self::USER_ID, $object->getUserId());
64  $this->assertEquals(self::LP_STATUS, $object->getLearningProgressStatus());
65  $this->assertEquals(self::AVAILABILITY_STATUS, $object->getAvailability());
66 
67  return $object;
68  }
69 
73  public function testTurnedOffWithPostCondition(LSItem $object): void
74  {
75  $this->expectException(LogicException::class);
76  $object->withPostCondition($this->post_condition);
77  }
78 
82  public function testTurnedOffWithOrderNumber(LSItem $object): void
83  {
84  $this->expectException(LogicException::class);
85  $object->withOrderNumber(self::ORDER_NUMBER);
86  }
87 
91  public function testTurnedOffWithOnline(LSItem $object): void
92  {
93  $this->expectException(LogicException::class);
94  $object->withOnline(self::IS_ONLINE);
95  }
96 }
testTurnedOffWithPostCondition(LSItem $object)
testCreate
withOrderNumber(int $order_number)
Definition: LSItem.php:102
ilLSPostCondition $post_condition
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: LSItem.php:24
withPostCondition(ilLSPostCondition $post_condition)
Definition: LSItem.php:109
testTurnedOffWithOrderNumber(LSItem $object)
testCreate
testTurnedOffWithOnline(LSItem $object)
testCreate
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
withOnline(bool $online)
Definition: LSItem.php:95
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...