ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilDBStepReaderTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
28  public $step_numbers;
29  public function setStepNumbers(array $arr): void
30  {
31  $this->step_numbers = $arr;
32  }
33 }
34 
36 {
37  public $called = [];
38 
39  protected ?ilDBInterface $db = null;
40 
41  public function prepare(ilDBInterface $db): void
42  {
43  $this->db = $db;
44  }
45 
46 
47  public function step_1()
48  {
49  }
50 
51  // 4 comes before 2 to check if the class gets the sorting right
52  public function step_4()
53  {
54  }
55 
56  public function step_2()
57  {
58  }
59 }
60 
62 {
63  public function testObjectCreation(): void
64  {
65  $obj = new ilDBStepReader();
66  $this->assertInstanceOf(ilDBStepReader::class, $obj);
67  }
68 
69  public function test_getLatestStepNumber(): void
70  {
71  $obj = new ilDBStepReaderTestObject();
72  $this->assertEquals(4, $obj->getLatestStepNumber(Test_ilDBStepReader::class, "step_"));
73  }
74 
75  public function test_readSteps(): void
76  {
77  $obj = new ilDBStepReaderTestObject();
78  $result = $obj->readStepNumbers(Test_ilDBStepReader::class, "step_");
79 
80  $this->assertIsArray($result);
81  $this->assertEquals(1, $result[0]);
82  $this->assertEquals(2, $result[1]);
83  $this->assertEquals(4, $result[2]);
84  }
85 }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
prepare(ilDBInterface $db)