ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
class.ilTestNoHintsDBUpdateSteps.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Test\Setup;
22 
24 {
25  protected \ilDBInterface $db;
26 
27  public function prepare(\ilDBInterface $db): void
28  {
29  $this->db = $db;
30  }
31 
32  private function dropCols($table, $cols): void
33  {
34  foreach ($cols as $col) {
35  if ($this->db->tableColumnExists($table, $col)) {
36  $this->db->dropTableColumn($table, $col);
37  }
38  }
39  }
40 
41  public function step_1(): void
42  {
43  $this->dropCols('tst_tests', [
44  'offer_question_hints',
45  'highscore_hints'
46  ]);
47  }
48 
49  public function step_2(): void
50  {
51  $this->dropCols('tst_test_result', [
52  'hint_count',
53  'hint_points'
54  ]);
55  }
56 
57  public function step_3(): void
58  {
59  $this->dropCols('tst_pass_result', [
60  'hint_count',
61  'hint_points'
62  ]);
63  }
64 
65  public function step_4(): void
66  {
67  $this->dropCols('tst_result_cache', [
68  'hint_count',
69  'hint_points'
70  ]);
71  }
72 
73  public function step_5(): void
74  {
75  if ($this->db->tableExists('qpl_hint_tracking')) {
76  $this->db->dropTable('qpl_hint_tracking');
77  }
78  if ($this->db->tableExists('qpl_hint_tracking_seq')) {
79  $this->db->dropTable('qpl_hint_tracking_seq');
80  }
81  }
82 
83  public function step_6(): void
84  {
85  if ($this->db->tableExists('qpl_hints')) {
86  $this->db->dropTable('qpl_hints');
87  }
88  }
89 
90  public function step_7(): void
91  {
92  $query = "DELETE FROM page_object WHERE parent_type = 'qht'";
93  $this->db->manipulate($query);
94  }
95 
96 }
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...