Skip to content

Commit

Permalink
build(deps): bump jquery-ui from 1.13.3 to 1.14.0
Browse files Browse the repository at this point in the history
* build(deps): bump jquery-ui from 1.13.3 to 1.14.0

Bumps [jquery-ui](https://github.com/jquery/jquery-ui) from 1.13.3 to 1.14.0.
- [Release notes](https://github.com/jquery/jquery-ui/releases)
- [Commits](jquery/jquery-ui@1.13.3...1.14.0)

---
updated-dependencies:
- dependency-name: jquery-ui
  dependency-type: direct:production
  update-type: version-update:semver-minor
...
  • Loading branch information
dependabot[bot] authored Sep 11, 2024
1 parent d7f4a96 commit c76c4cf
Show file tree
Hide file tree
Showing 13 changed files with 297 additions and 62 deletions.
26 changes: 24 additions & 2 deletions install/empty_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -9158,8 +9158,10 @@ public function getEmptyData(): array
// Test environment data
if ($is_testing) {
$root_entity = array_filter($tables['glpi_entities'], static fn ($e) => $e['id'] === 0);
$e2e_entity = array_shift($root_entity);
$e2e_entity = array_replace($e2e_entity, [
$root_entity = current($root_entity);

// Main E2E test entity
$e2e_entity = array_replace($root_entity, [
'id' => 1,
'name' => 'E2ETestEntity',
'entities_id' => 0,
Expand All @@ -9168,6 +9170,26 @@ public function getEmptyData(): array
]);
$tables['glpi_entities'][] = $e2e_entity;

// Sub entity 1
$e2e_subentity1 = array_replace($root_entity, [
'id' => 2,
'name' => 'E2ETestSubEntity1',
'entities_id' => 1,
'completename' => __('Root entity') . ' > E2ETestEntity > E2ETestSubEntity1',
'level' => 3,
]);
$tables['glpi_entities'][] = $e2e_subentity1;

// Sub entity 2
$e2e_subentity2 = array_replace($root_entity, [
'id' => 3,
'name' => 'E2ETestSubEntity2',
'entities_id' => 1,
'completename' => __('Root entity') . ' > E2ETestEntity > E2ETestSubEntity2',
'level' => 3,
]);
$tables['glpi_entities'][] = $e2e_subentity2;

// New e2e super-admin user (login: e2e_tests, password: glpi)
$default_glpi_user = array_filter($tables['glpi_users'], static fn ($u) => $u['id'] === self::USER_GLPI);
$e2e_user = array_shift($default_glpi_user);
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"jquery": "^3.7.1",
"jquery-migrate": "^3.5.2",
"jquery-prettytextdiff": "^1.0.4",
"jquery-ui": "^1.13.3",
"jquery-ui": "^1.14.0",
"jquery.fancytree": "^2.38.3",
"jquery.rateit": "^1.1.6",
"leaflet": "^1.9.4",
Expand Down
78 changes: 42 additions & 36 deletions phpunit/functional/DbUtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,10 @@ public function testGetEntityRestrict()
$this->login();
$instance = new \DbUtils();

$root = getItemByTypeName('Entity', '_test_root_entity', true);
$child1 = getItemByTypeName('Entity', '_test_child_1', true);
$child2 = getItemByTypeName('Entity', '_test_child_2', true);

// See all, really all
$_SESSION['glpishowallentities'] = 1; // will be restored by setEntity call

Expand All @@ -593,162 +597,162 @@ public function testGetEntityRestrict()
$this->setEntity('_test_root_entity', true);

$this->assertSame(
"WHERE ( `glpi_computers`.`entities_id` IN ('2', '3', '4') ) ",
"WHERE ( `glpi_computers`.`entities_id` IN ('$root', '$child1', '$child2') ) ",
$instance->getEntitiesRestrictRequest('WHERE', 'glpi_computers')
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => $instance->getEntitiesRestrictCriteria('glpi_computers')]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE `glpi_computers`.`entities_id` IN (\'2\', \'3\', \'4\')',
"SELECT * FROM `glpi_computers` WHERE `glpi_computers`.`entities_id` IN ('$root', '$child1', '$child2')",
$it->getSql()
);

//keep testing old method from db.function
$this->assertSame(
"WHERE ( `glpi_computers`.`entities_id` IN ('2', '3', '4') ) ",
"WHERE ( `glpi_computers`.`entities_id` IN ('$root', '$child1', '$child2') ) ",
getEntitiesRestrictRequest('WHERE', 'glpi_computers')
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => getEntitiesRestrictCriteria('glpi_computers')]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE (`glpi_computers`.`entities_id` IN (\'2\', \'3\', \'4\'))',
"SELECT * FROM `glpi_computers` WHERE (`glpi_computers`.`entities_id` IN ('$root', '$child1', '$child2'))",
$it->getSql()
);

// Root entity
$this->setEntity('_test_root_entity', false);

$this->assertSame(
"WHERE ( `glpi_computers`.`entities_id` IN ('2') ) ",
"WHERE ( `glpi_computers`.`entities_id` IN ('$root') ) ",
$instance->getEntitiesRestrictRequest('WHERE', 'glpi_computers')
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => $instance->getEntitiesRestrictCriteria('glpi_computers')]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE `glpi_computers`.`entities_id` IN (\'2\')',
"SELECT * FROM `glpi_computers` WHERE `glpi_computers`.`entities_id` IN ('$root')",
$it->getSql()
);

//keep testing old method from db.function
$this->assertSame(
"WHERE ( `glpi_computers`.`entities_id` IN ('2') ) ",
"WHERE ( `glpi_computers`.`entities_id` IN ('$root') ) ",
getEntitiesRestrictRequest('WHERE', 'glpi_computers')
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => getEntitiesRestrictCriteria('glpi_computers')]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE (`glpi_computers`.`entities_id` IN (\'2\'))',
"SELECT * FROM `glpi_computers` WHERE (`glpi_computers`.`entities_id` IN ('$root'))",
$it->getSql()
);

// Child
$this->setEntity('_test_child_1', false);

$this->assertSame(
"WHERE ( `glpi_computers`.`entities_id` IN ('3') ) ",
"WHERE ( `glpi_computers`.`entities_id` IN ('$child1') ) ",
$instance->getEntitiesRestrictRequest('WHERE', 'glpi_computers')
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => $instance->getEntitiesRestrictCriteria('glpi_computers')]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE `glpi_computers`.`entities_id` IN (\'3\')',
"SELECT * FROM `glpi_computers` WHERE `glpi_computers`.`entities_id` IN ('$child1')",
$it->getSql()
);

//keep testing old method from db.function
$this->assertSame(
"WHERE ( `glpi_computers`.`entities_id` IN ('3') ) ",
"WHERE ( `glpi_computers`.`entities_id` IN ('$child1') ) ",
getEntitiesRestrictRequest('WHERE', 'glpi_computers')
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => getEntitiesRestrictCriteria('glpi_computers')]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE (`glpi_computers`.`entities_id` IN (\'3\'))',
"SELECT * FROM `glpi_computers` WHERE (`glpi_computers`.`entities_id` IN ('$child1'))",
$it->getSql()
);

// Child without table
$this->assertSame(
"WHERE ( `entities_id` IN ('3') ) ",
"WHERE ( `entities_id` IN ('$child1') ) ",
$instance->getEntitiesRestrictRequest('WHERE')
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => $instance->getEntitiesRestrictCriteria()]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE `entities_id` IN (\'3\')',
"SELECT * FROM `glpi_computers` WHERE `entities_id` IN ('$child1')",
$it->getSql()
);

//keep testing old method from db.function
$this->assertSame(
"WHERE ( `entities_id` IN ('3') ) ",
"WHERE ( `entities_id` IN ('$child1') ) ",
getEntitiesRestrictRequest('WHERE')
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => getEntitiesRestrictCriteria()]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE (`entities_id` IN (\'3\'))',
"SELECT * FROM `glpi_computers` WHERE (`entities_id` IN ('$child1'))",
$it->getSql()
);

// Child + parent
$this->setEntity('_test_child_2', false);

$this->assertSame(
"WHERE ( `glpi_computers`.`entities_id` IN ('4') OR (`glpi_computers`.`is_recursive`='1' AND `glpi_computers`.`entities_id` IN (0, 2)) ) ",
"WHERE ( `glpi_computers`.`entities_id` IN ('$child2') OR (`glpi_computers`.`is_recursive`='1' AND `glpi_computers`.`entities_id` IN (0, $root)) ) ",
$instance->getEntitiesRestrictRequest('WHERE', 'glpi_computers', '', '', true)
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => $instance->getEntitiesRestrictCriteria('glpi_computers', '', '', true)]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE (`glpi_computers`.`entities_id` IN (\'4\') OR (`glpi_computers`.`is_recursive` = \'1\' AND `glpi_computers`.`entities_id` IN (\'0\', \'2\')))',
"SELECT * FROM `glpi_computers` WHERE (`glpi_computers`.`entities_id` IN ('$child2') OR (`glpi_computers`.`is_recursive` = '1' AND `glpi_computers`.`entities_id` IN ('0', '$root')))",
$it->getSql()
);

//keep testing old method from db.function
$this->assertSame(
"WHERE ( `glpi_computers`.`entities_id` IN ('4') OR (`glpi_computers`.`is_recursive`='1' AND `glpi_computers`.`entities_id` IN (0, 2)) ) ",
"WHERE ( `glpi_computers`.`entities_id` IN ('$child2') OR (`glpi_computers`.`is_recursive`='1' AND `glpi_computers`.`entities_id` IN (0, $root)) ) ",
getEntitiesRestrictRequest('WHERE', 'glpi_computers', '', '', true)
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => getEntitiesRestrictCriteria('glpi_computers', '', '', true)]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE ((`glpi_computers`.`entities_id` IN (\'4\') OR (`glpi_computers`.`is_recursive` = \'1\' AND `glpi_computers`.`entities_id` IN (\'0\', \'2\'))))',
"SELECT * FROM `glpi_computers` WHERE ((`glpi_computers`.`entities_id` IN ('$child2') OR (`glpi_computers`.`is_recursive` = '1' AND `glpi_computers`.`entities_id` IN ('0', '$root'))))",
$it->getSql()
);

//Child + parent on glpi_entities
$it->execute(['FROM' => 'glpi_entities', 'WHERE' => $instance->getEntitiesRestrictCriteria('glpi_entities', '', '', true)]);
$this->assertSame(
'SELECT * FROM `glpi_entities` WHERE (`glpi_entities`.`id` IN (\'4\', \'0\', \'2\'))',
"SELECT * FROM `glpi_entities` WHERE (`glpi_entities`.`id` IN ('$child2', '0', '$root'))",
$it->getSql()
);

//keep testing old method from db.function
$it->execute(['FROM' => 'glpi_entities', 'WHERE' => getEntitiesRestrictCriteria('glpi_entities', '', '', true)]);
$this->assertSame(
'SELECT * FROM `glpi_entities` WHERE ((`glpi_entities`.`id` IN (\'4\', \'0\', \'2\')))',
"SELECT * FROM `glpi_entities` WHERE ((`glpi_entities`.`id` IN ('$child2', '0', '$root')))",
$it->getSql()
);

//Child + parent -- automatic recusrivity detection
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => $instance->getEntitiesRestrictCriteria('glpi_computers', '', '', 'auto')]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE (`glpi_computers`.`entities_id` IN (\'4\') OR (`glpi_computers`.`is_recursive` = \'1\' AND `glpi_computers`.`entities_id` IN (\'0\', \'2\')))',
"SELECT * FROM `glpi_computers` WHERE (`glpi_computers`.`entities_id` IN ('$child2') OR (`glpi_computers`.`is_recursive` = '1' AND `glpi_computers`.`entities_id` IN ('0', '$root')))",
$it->getSql()
);

//keep testing old method from db.function
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => getEntitiesRestrictCriteria('glpi_computers', '', '', 'auto')]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE ((`glpi_computers`.`entities_id` IN (\'4\') OR (`glpi_computers`.`is_recursive` = \'1\' AND `glpi_computers`.`entities_id` IN (\'0\', \'2\'))))',
"SELECT * FROM `glpi_computers` WHERE ((`glpi_computers`.`entities_id` IN ('$child2') OR (`glpi_computers`.`is_recursive` = '1' AND `glpi_computers`.`entities_id` IN ('0', '$root'))))",
$it->getSql()
);

// Child + parent without table
$this->assertSame(
"WHERE ( `entities_id` IN ('4') OR (`is_recursive`='1' AND `entities_id` IN (0, 2)) ) ",
"WHERE ( `entities_id` IN ('$child2') OR (`is_recursive`='1' AND `entities_id` IN (0, $root)) ) ",
$instance->getEntitiesRestrictRequest('WHERE', '', '', '', true)
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => $instance->getEntitiesRestrictCriteria('', '', '', true)]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE (`entities_id` IN (\'4\') OR (`is_recursive` = \'1\' AND `entities_id` IN (\'0\', \'2\')))',
"SELECT * FROM `glpi_computers` WHERE (`entities_id` IN ('$child2') OR (`is_recursive` = '1' AND `entities_id` IN ('0', '$root')))",
$it->getSql()
);

$it->execute(['FROM' => 'glpi_entities', 'WHERE' => $instance->getEntitiesRestrictCriteria('glpi_entities', '', 3, true)]);
$it->execute(['FROM' => 'glpi_entities', 'WHERE' => $instance->getEntitiesRestrictCriteria('glpi_entities', '', $child1, true)]);
$this->assertSame(
'SELECT * FROM `glpi_entities` WHERE (`glpi_entities`.`id` IN (\'3\', \'0\', \'2\'))',
"SELECT * FROM `glpi_entities` WHERE (`glpi_entities`.`id` IN ('$child1', '0', '$root'))",
$it->getSql()
);

Expand All @@ -760,18 +764,18 @@ public function testGetEntityRestrict()

//keep testing old method from db.function
$this->assertSame(
"WHERE ( `entities_id` IN ('4') OR (`is_recursive`='1' AND `entities_id` IN (0, 2)) ) ",
"WHERE ( `entities_id` IN ('$child2') OR (`is_recursive`='1' AND `entities_id` IN (0, $root)) ) ",
getEntitiesRestrictRequest('WHERE', '', '', '', true)
);
$it->execute(['FROM' => 'glpi_computers', 'WHERE' => getEntitiesRestrictCriteria('', '', '', true)]);
$this->assertSame(
'SELECT * FROM `glpi_computers` WHERE ((`entities_id` IN (\'4\') OR (`is_recursive` = \'1\' AND `entities_id` IN (\'0\', \'2\'))))',
"SELECT * FROM `glpi_computers` WHERE ((`entities_id` IN ('$child2') OR (`is_recursive` = '1' AND `entities_id` IN ('0', '$root'))))",
$it->getSql()
);

$it->execute(['FROM' => 'glpi_entities', 'WHERE' => getEntitiesRestrictCriteria('glpi_entities', '', 3, true)]);
$it->execute(['FROM' => 'glpi_entities', 'WHERE' => getEntitiesRestrictCriteria('glpi_entities', '', $child1, true)]);
$this->assertSame(
'SELECT * FROM `glpi_entities` WHERE ((`glpi_entities`.`id` IN (\'3\', \'0\', \'2\')))',
"SELECT * FROM `glpi_entities` WHERE ((`glpi_entities`.`id` IN ('$child1', '0', '$root')))",
$it->getSql()
);

Expand Down Expand Up @@ -823,7 +827,7 @@ private function runGetAncestorsOf($cache = false, $hit = false)
}

//test on ent1
$expected = [0 => 0, 2 => $ent0];
$expected = [0 => 0, $ent0 => $ent0];
if ($cache === true && $hit === false) {
$this->assertFalse($GLPI_CACHE->has($ckey_ent1));
} else if ($cache === true && $hit === true) {
Expand All @@ -838,7 +842,7 @@ private function runGetAncestorsOf($cache = false, $hit = false)
}

//test on ent2
$expected = [0 => 0, 2 => $ent0];
$expected = [0 => 0, $ent0 => $ent0];
if ($cache === true && $hit === false) {
$this->assertFalse($GLPI_CACHE->has($ckey_ent2));
} else if ($cache === true && $hit === true) {
Expand Down Expand Up @@ -1432,6 +1436,8 @@ public function testGetDateCriteriaError2()

public static function autoNameProvider()
{
$test_child_1 = getItemByTypeName('Entity', '_test_child_1', true);

return [
//will return name without changes
[
Expand Down Expand Up @@ -1464,15 +1470,15 @@ public static function autoNameProvider()
'field' => 'name',
'is_template' => true,
'itemtype' => 'Computer',
'entities_id' => 3,
'entities_id' => $test_child_1,
'expected' => '_test_pc14'
], [
// not existing on entity, not sanitized, and containing a special char
'name' => '<pc_>_##>',
'field' => 'name',
'is_template' => true,
'itemtype' => 'Computer',
'entities_id' => 3,
'entities_id' => $test_child_1,
'expected' => 'pc_>_01'
],
];
Expand Down
15 changes: 13 additions & 2 deletions phpunit/functional/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private function checkParentsSonsAreReset()
$ent1 = getItemByTypeName('Entity', '_test_child_1', true);
$ent2 = getItemByTypeName('Entity', '_test_child_2', true);

$expected = [0 => 0, 2 => $ent0];
$expected = [0 => 0, $ent0 => $ent0];
$ancestors = getAncestorsOf('glpi_entities', $ent1);
$this->assertSame($expected, $ancestors);

Expand Down Expand Up @@ -1204,6 +1204,8 @@ public function testRename()
public static function entityTreeProvider(): iterable
{
$e2e_test_root = getItemByTypeName('Entity', 'E2ETestEntity', true);
$e2e_test_child1 = getItemByTypeName('Entity', 'E2ETestSubEntity1', true);
$e2e_test_child2 = getItemByTypeName('Entity', 'E2ETestSubEntity2', true);
$entity_test_root = getItemByTypeName('Entity', '_test_root_entity');
$entity_test_child_1 = getItemByTypeName('Entity', '_test_child_1');
$entity_test_child_2 = getItemByTypeName('Entity', '_test_child_2');
Expand All @@ -1216,7 +1218,16 @@ public static function entityTreeProvider(): iterable
'tree' => [
$e2e_test_root => [
'name' => 'E2ETestEntity',
'tree' => []
'tree' => [
$e2e_test_child1 => [
'name' => 'E2ETestSubEntity1',
'tree' => [],
],
$e2e_test_child2 => [
'name' => 'E2ETestSubEntity2',
'tree' => [],
],
],
],
$entity_test_root->getID() => [
'name' => $entity_test_root->fields['name'],
Expand Down
Loading

0 comments on commit c76c4cf

Please sign in to comment.