diff --git a/inc/deployuserinteraction.class.php b/inc/deployuserinteraction.class.php index 7a2f8b01a..3d01aa15b 100644 --- a/inc/deployuserinteraction.class.php +++ b/inc/deployuserinteraction.class.php @@ -395,7 +395,7 @@ function save_item($params) { 'name' => $params['name'], 'title' => $params['title'], 'text' => $params['text'], - 'type' => $params['userinteractionstype'], + 'type' => $params['type'], 'template' => $params['template'] ]; diff --git a/tests/Unit/Deploy/DeployUserinteractionTest.php b/tests/Unit/Deploy/DeployUserinteractionTest.php index fbb89b8c2..40211500a 100644 --- a/tests/Unit/Deploy/DeployUserinteractionTest.php +++ b/tests/Unit/Deploy/DeployUserinteractionTest.php @@ -183,22 +183,21 @@ public function testAdd_item() { $packages_id = $pfDeployPackage->add($input); $interaction = new PluginFusioninventoryDeployUserinteraction(); - $params = ['id' => $packages_id, - 'userinteractionstype' => 'before', - 'name' => 'My interaction', + $params = ['id' => intval($packages_id), + 'type' => 'before', 'name' => 'interaction 1', 'title' => 'My title', 'text' => 'my text', 'template' => 0, ]; + $interaction->add_item($params); $expected = '{"jobs":{"checks":[],"associatedFiles":[],"actions":[],"userinteractions":[{"name":"interaction 1","title":"My title","text":"my text","type":"before","template":0}]},"associatedFiles":[]}'; $json = Toolbox::stripslashes_deep($interaction->getJson($packages_id)); $this->assertEquals($expected, $json); - $params = ['id' => $packages_id, - 'userinteractionstype' => 'after', - 'name' => 'My interaction 2', + $params = ['id' => intval($packages_id), + 'type' => 'after', 'name' => 'interaction 2', 'title' => 'My title', 'text' => 'my text', diff --git a/tests/Unit/Deploy/PackageJsonTest.php b/tests/Unit/Deploy/PackageJsonTest.php index 613f14288..958a4cd0a 100644 --- a/tests/Unit/Deploy/PackageJsonTest.php +++ b/tests/Unit/Deploy/PackageJsonTest.php @@ -76,14 +76,15 @@ public function AddItem() { // Add check $item = [ - 'id' => $packages_id, + 'id' => intval($packages_id), 'name' => 'check winkey', - 'itemtype' => 'PluginFusioninventoryDeployCheck', 'checkstype' => 'winkeyExists', 'path' => 'toto', 'return' => 'error', - 'add_item' => 'Add' + 'value' => '', + 'unit' => '' ]; + $pfDeployCheck->add_item($item); $pfDeployPackage->getFromDB($packages_id);