ILIAS  release_8 Revision v8.24
ilDBStepReaderTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21use PHPUnit\Framework\TestCase;
22
24{
25 public function setStepNumbers(array $arr): void
26 {
27 $this->step_numbers = $arr;
28 }
29}
30
32{
33 public $called = [];
34
35 protected ?ilDBInterface $db = null;
36
37 public function prepare(ilDBInterface $db): void
38 {
39 $this->db = $db;
40 }
41
42
43 public function step_1()
44 {
45 }
46
47 // 4 comes before 2 to check if the class gets the sorting right
48 public function step_4()
49 {
50 }
51
52 public function step_2()
53 {
54 }
55}
56
57class ilDBStepReaderTest extends TestCase
58{
59 public function testObjectCreation(): void
60 {
61 $obj = new ilDBStepReader();
62 $this->assertInstanceOf(ilDBStepReader::class, $obj);
63 }
64
65 public function test_getLatestStepNumber(): void
66 {
67 $obj = new ilDBStepReaderTestObject();
68 $this->assertEquals(4, $obj->getLatestStepNumber(Test_ilDBStepReader::class, "step_"));
69 }
70
71 public function test_readSteps(): void
72 {
73 $obj = new ilDBStepReaderTestObject();
74 $result = $obj->readStepNumbers(Test_ilDBStepReader::class, "step_");
75
76 $this->assertIsArray($result);
77 $this->assertEquals(1, $result[0]);
78 $this->assertEquals(2, $result[1]);
79 $this->assertEquals(4, $result[2]);
80 }
81}
prepare(ilDBInterface $db)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...