Skip to content

Commit 0c0fe50

Browse files
committed
Fix units tests
1 parent 1a20c84 commit 0c0fe50

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/Config.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ public static function install(Migration $migration): void
255255
`id` int unsigned NOT NULL AUTO_INCREMENT,
256256
`is_active` tinyint NOT NULL DEFAULT '1',
257257
`entities_id` int unsigned NOT NULL DEFAULT '0',
258-
`take_item_group_ticket` tinyint NOT NULL DEFAULT '-2',
258+
`use_parent_entity` tinyint NOT NULL DEFAULT '0',
259+
`take_item_group_ticket` tinyint NOT NULL DEFAULT '-2',
259260
`take_item_group_change` tinyint NOT NULL DEFAULT '0',
260261
`take_item_group_problem` tinyint NOT NULL DEFAULT '0',
261262
`take_requester_group_ticket` int unsigned NOT NULL DEFAULT '0',
@@ -300,6 +301,16 @@ public static function install(Migration $migration): void
300301
$DB->doQuery($query);
301302
}
302303

304+
// Migration: Add use_parent_entity column if it doesn't exist
305+
if (!$DB->fieldExists($table, 'use_parent_entity')) {
306+
$migration->displayMessage("Adding use_parent_entity field to $table");
307+
$migration->addField($table, 'use_parent_entity', 'tinyint', [
308+
'after' => 'entities_id',
309+
'value' => 0,
310+
'nodefault' => false,
311+
]);
312+
}
313+
303314
$entities = new Entity();
304315
foreach ($entities->find() as $entity) {
305316
if (is_array($entity) && isset($entity['id'])) {

tests/Units/ConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ public function testUpdateActorsDisabledConfiguration(): void
12121212
*/
12131213
public function testParentEntityConfigInheritance(): void
12141214
{
1215-
$parent_entity_id = false;
1215+
$parent_entity_id = 0; // Root entity
12161216
// Create child entity
12171217
$child_entity = new \Entity();
12181218
$child_entity_id = $child_entity->add([

tests/bootstrap.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@
3737

3838
define('GLPI_LOG_DIR', __DIR__ . '/files/_logs');
3939

40+
require_once __DIR__ . '/../../../vendor/autoload.php';
41+
4042
require_once __DIR__ . '/../../../tests/GLPITestCase.php';
4143
require_once __DIR__ . '/../../../tests/DbTestCase.php';
42-
require_once __DIR__ . '/../../../vendor/autoload.php';
4344
require_once __DIR__ . '/MoreOptionsTestCase.php';
4445

4546
$kernel = new Kernel(Environment::TESTING->value);

0 commit comments

Comments
 (0)