Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ddurieux committed Apr 11, 2024
1 parent 96c1d20 commit a0c62f0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion inc/deployuserinteraction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']
];

Expand Down
11 changes: 5 additions & 6 deletions tests/Unit/Deploy/DeployUserinteractionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
7 changes: 4 additions & 3 deletions tests/Unit/Deploy/PackageJsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a0c62f0

Please sign in to comment.