ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDBStepReaderTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
22
24{
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
61class ilDBStepReaderTest extends TestCase
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->assertSame(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}
prepare(ilDBInterface $db)
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...