ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestRandomQuestionSetSourcePoolDefinitionListTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
28
29 protected function setUp(): void
30 {
31 parent::setUp();
32
34 $this->createMock(ilDBInterface::class),
35 $this->getTestObjMock(),
36 $this->createMock(ilTestRandomQuestionSetSourcePoolDefinitionFactory::class)
37 );
38 }
39
41 {
42 $this->assertInstanceOf(ilTestRandomQuestionSetSourcePoolDefinitionList::class, $this->testObj);
43 }
44
45 public function testAddDefinition(): void
46 {
47 $id = 20;
49 $this->createMock(ilDBInterface::class),
50 $this->getTestObjMock()
51 );
52 $expected->setId($id);
53 $this->testObj->addDefinition($expected);
54
55 $this->assertEquals($expected, $this->testObj->getDefinition($id));
56 }
57
58 public function testSetTrashedPools(): void
59 {
60 $poolIds = [12, 22, 16];
61
62 $this->testObj->setTrashedPools($poolIds);
63
64 $this->assertEquals($poolIds, $this->testObj->getTrashedPools());
65 }
66
67 public function testIsTrashedPool(): void
68 {
69 $poolIds = [12, 22, 16];
70
71 $this->testObj->setTrashedPools($poolIds);
72
73 $this->assertTrue($this->testObj->isTrashedPool(0));
74 $this->assertFalse($this->testObj->isTrashedPool(4));
75 }
76
77 public function testHasTrashedPool(): void
78 {
79 $poolIds = [12, 22, 16];
80
81 $this->testObj->setTrashedPools($poolIds);
82
83 $this->assertTrue($this->testObj->hasTrashedPool());
84 }
85
86 public function testHasDefinition(): void
87 {
89 $this->createMock(ilDBInterface::class),
90 $this->getTestObjMock()
91 );
92 $id = 20;
93 $expected->setId($id);
94 $this->testObj->addDefinition($expected);
95
96 $this->assertTrue($this->testObj->hasDefinition($id));
97 }
98
99 public function testGetDefinition(): void
100 {
102 $this->createMock(ilDBInterface::class),
103 $this->getTestObjMock()
104 );
105 $id = 20;
106 $expected->setId($id);
107 $this->testObj->addDefinition($expected);
108
109 $this->assertEquals($expected, $this->testObj->getDefinition($id));
110 }
111
112 public function testGetDefinitionBySourcePoolId(): void
113 {
115 $this->createMock(ilDBInterface::class),
116 $this->getTestObjMock()
117 );
118 $id = 20;
119 $poolId = 11;
120 $expected->setId($id);
121 $expected->setPoolId($poolId);
122 $this->testObj->addDefinition($expected);
123
124 $this->assertEquals($expected, $this->testObj->getDefinitionBySourcePoolId($poolId));
125 }
126
127 public function testGetDefinitionIds(): void
128 {
130 $this->createMock(ilDBInterface::class),
131 $this->getTestObjMock()
132 );
133 $id = 20;
134 $poolId = 11;
135 $expected->setId($id);
136 $expected->setPoolId($poolId);
137 $this->testObj->addDefinition($expected);
138
139 $this->assertEquals([$id], $this->testObj->getDefinitionIds());
140 }
141
142 public function testGetDefinitionCount(): void
143 {
145 $this->createMock(ilDBInterface::class),
146 $this->getTestObjMock()
147 );
148 $expected->setId(20);
149 $expected->setPoolId(11);
150 $this->testObj->addDefinition($expected);
151
152 $this->assertEquals(1, $this->testObj->getDefinitionCount());
153 }
154}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Class ilTestBaseClass.