Skip to content

Commit c98de4c

Browse files
committed
Merge remote-tracking branch 'origin/support/2.13.0' into support/2.14.0
2 parents 36400b0 + f30c28e commit c98de4c

3 files changed

Lines changed: 17 additions & 12 deletions

File tree

ajax/homepage_wizard.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@
3535
exit;
3636
}
3737

38+
if (!isset($_REQUEST['wizard'])) {
39+
http_response_code(400);
40+
die();
41+
}
42+
3843
if ($_REQUEST['wizard'] == 'categories') {
3944
plugin_formcreator_showWizardCategories();
4045
} else if ($_REQUEST['wizard'] == 'forms') {
41-
if (isset($_REQUEST['categoriesId'])) {
42-
$categoriesId = (int) $_REQUEST['categoriesId'];
43-
} else {
44-
$categoriesId = 0;
45-
}
46+
$categoriesId = (int) ($_REQUEST['categoriesId'] ?? 0);
4647
$keywords = isset($_REQUEST['keywords']) ? $_REQUEST['keywords'] : '';
4748
$helpdeskHome = isset($_REQUEST['helpdeskHome']) ? $_REQUEST['helpdeskHome'] != '0' : false;
4849
plugin_formcreator_showWizardForms($categoriesId, $keywords, $helpdeskHome);

inc/issue.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ public function rawSearchOptions() {
12421242
'joinparams' => [
12431243
'jointype' => 'empty',
12441244
'condition' => [
1245-
new \QueryExpression(
1245+
new QueryExpression(
12461246
'1=1'
12471247
),
12481248
],

tests/3-unit/PluginFormcreatorCategory.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
*/
3131
namespace tests\units;
3232
use GlpiPlugin\Formcreator\Tests\CommonTestCase;
33+
use Entity;
34+
use PluginFormcreatorForm;
35+
use Session;
3336

3437
class PluginFormcreatorCategory extends CommonTestCase {
3538
public function providerGetTypeName() {
@@ -80,15 +83,15 @@ public function testGetCategoryTree() {
8083

8184
// create a sub entity which will take in the forms and cateory for this test
8285
// and not conflict with previous data
83-
$entity = new \Entity();
86+
$entity = new Entity();
8487
$rand = mt_rand();
8588
$entities_id = $entity->add([
8689
'name' => "test formcreator sub entity $rand",
8790
'entities_id' => 0
8891
]);
8992

9093
// create some categories for forms
91-
$category = new \PluginFormcreatorCategory;
94+
$category = $this->newTestedInstance();
9295
$categories = [];
9396
for ($i = 0; $i < 5; $i++) {
9497
$root_cat = $category->add([
@@ -104,7 +107,7 @@ public function testGetCategoryTree() {
104107
}
105108

106109
// create some forms
107-
$form = new \PluginFormcreatorForm;
110+
$form = new PluginFormcreatorForm;
108111
for ($i = 0; $i < 10; $i++) {
109112
$form->add([
110113
'name' => "testgetCategoryTree form $i",
@@ -116,10 +119,11 @@ public function testGetCategoryTree() {
116119
}
117120

118121
// Set active entity
119-
\Session::changeActiveEntities($entities_id, true);
122+
Session::changeActiveEntities($entities_id, true);
120123

121124
//test method
122-
$tree = \PluginFormcreatorCategory::getCategoryTree();
125+
$testedClassName = $this->getTestedClassName();
126+
$tree = $testedClassName::getCategoryTree();
123127
$this->array($tree)
124128
->isNotEmpty()
125129
->child['subcategories'](function($child) {
@@ -132,6 +136,6 @@ public function testGetCategoryTree() {
132136
}
133137

134138
// return to root entity
135-
\Session::changeActiveEntities(0, true);
139+
Session::changeActiveEntities(0, true);
136140
}
137141
}

0 commit comments

Comments
 (0)