ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestRandomQuestionSetSourcePoolDefinitionListTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
26 {
28 
29  protected function setUp(): void
30  {
31  parent::setUp();
32 
34  $this->createMock(ilDBInterface::class),
35  $this->createMock(ilObjTest::class),
36  $this->createMock(ilTestRandomQuestionSetSourcePoolDefinitionFactory::class)
37  );
38  }
39 
41  {
42  $this->assertInstanceOf(ilTestRandomQuestionSetSourcePoolDefinitionList::class, $this->testObj);
43  }
44 
45  public function testAddDefinition(): void
46  {
48  $this->createMock(ilDBInterface::class),
49  $this->createMock(ilObjTest::class)
50  );
51  $expected->setId(20);
52  $this->testObj->addDefinition($expected);
53 
54  $this->assertEquals($expected, $this->testObj->getDefinition(20));
55  }
56 
57  public function testSetTrashedPools(): void
58  {
59  $poolIds = [12, 22, 16];
60 
61  $this->testObj->setTrashedPools($poolIds);
62 
63  $this->assertEquals($poolIds, $this->testObj->getTrashedPools());
64  }
65 
66  public function testIsTrashedPool(): void
67  {
68  $poolIds = [12, 22, 16];
69 
70  $this->testObj->setTrashedPools($poolIds);
71 
72  $this->assertTrue($this->testObj->isTrashedPool(0));
73  $this->assertFalse($this->testObj->isTrashedPool(4));
74  }
75 
76  public function testHasTrashedPool(): void
77  {
78  $poolIds = [12, 22, 16];
79 
80  $this->testObj->setTrashedPools($poolIds);
81 
82  $this->assertTrue($this->testObj->hasTrashedPool());
83  }
84 
85  public function testHasDefinition(): void
86  {
88  $this->createMock(ilDBInterface::class),
89  $this->createMock(ilObjTest::class)
90  );
91  $expected->setId(20);
92  $this->testObj->addDefinition($expected);
93 
94  $this->assertTrue($this->testObj->hasDefinition(20));
95  }
96 
97  public function testGetDefinition(): void
98  {
100  $this->createMock(ilDBInterface::class),
101  $this->createMock(ilObjTest::class)
102  );
103  $expected->setId(20);
104  $this->testObj->addDefinition($expected);
105 
106  $this->assertEquals($expected, $this->testObj->getDefinition(20));
107  }
108 
109  public function testGetDefinitionBySourcePoolId(): void
110  {
112  $this->createMock(ilDBInterface::class),
113  $this->createMock(ilObjTest::class)
114  );
115  $expected->setId(20);
116  $expected->setPoolId(11);
117  $this->testObj->addDefinition($expected);
118 
119  $this->assertEquals($expected, $this->testObj->getDefinitionBySourcePoolId(11));
120  }
121 
122  public function testGetDefinitionIds(): void
123  {
125  $this->createMock(ilDBInterface::class),
126  $this->createMock(ilObjTest::class)
127  );
128  $expected->setId(20);
129  $expected->setPoolId(11);
130  $this->testObj->addDefinition($expected);
131 
132  $this->assertEquals([20], $this->testObj->getDefinitionIds());
133  }
134 
135  public function testGetDefinitionCount(): void
136  {
138  $this->createMock(ilDBInterface::class),
139  $this->createMock(ilObjTest::class)
140  );
141  $expected->setId(20);
142  $expected->setPoolId(11);
143  $this->testObj->addDefinition($expected);
144 
145  $this->assertEquals(1, $this->testObj->getDefinitionCount());
146  }
147 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilTestBaseClass.