Skip to content

Commit

Permalink
fix(config): historical tab empty (#15968)
Browse files Browse the repository at this point in the history
* fix(config): historical tab empty

* add test
  • Loading branch information
Rom1-B authored Nov 9, 2023
1 parent be10135 commit e3cd042
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4020,12 +4020,11 @@ public static function getConfigIDForContext(string $context)
/** @var \DBmysql $DB */
global $DB;
$iterator = $DB->request([
'SELECT' => 'id',
'SELECT' => ['MIN' => 'id AS id'],
'FROM' => self::getTable(),
'WHERE' => [
'context' => $context,
],
'LIMIT' => 1,
]);
if (count($iterator)) {
return $iterator->current()['id'];
Expand Down
9 changes: 9 additions & 0 deletions tests/functional/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -923,4 +923,13 @@ public function testDetectRooDoc(): void
}
}
}

public function testConfigLogNotEmpty()
{
$itemtype = 'Config';
$config_id = \Config::getConfigIDForContext('core');
$this->integer($config_id)->isGreaterThan(0);
$total_number = countElementsInTable("glpi_logs", ['items_id' => $config_id, 'itemtype' => $itemtype]);
$this->integer($total_number)->isGreaterThan(0);
}
}

0 comments on commit e3cd042

Please sign in to comment.