ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
LSLearnerItemTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5use PHPUnit\Framework\TestCase;
7
8class LSLearnerItemTest extends TestCase
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}
An exception for terminatinating execution or to throw for unit testing.
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:10
Data holding class LSItem .
Definition: LSItem.php:12
withPostCondition(ilLSPostCondition $postcondition)
Definition: LSItem.php:122
withOrderNumber(int $order_number)
Definition: LSItem.php:110
withOnline(bool $online)
Definition: LSItem.php:98
testTurnedOffWithOnline(LSItem $object)
@depends testCreate
testTurnedOffWithOrderNumber(LSItem $object)
@depends testCreate
testTurnedOffWithPostCondition(LSItem $object)
@depends testCreate
Add learning progress and availability information to the LSItem.
A PostCondition does restrict the progression of a user through the learning sequence.