Skip to content

Commit

Permalink
Inventory options tests and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher authored Oct 14, 2024
1 parent 27164d7 commit 586e475
Show file tree
Hide file tree
Showing 13 changed files with 1,042 additions and 92 deletions.
6 changes: 0 additions & 6 deletions .phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -2467,12 +2467,6 @@
'count' => 1,
'path' => __DIR__ . '/src/Inventory/Asset/MainAsset.php',
];
$ignoreErrors[] = [
// identifier: property.onlyWritten
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\Monitor\\:\\:\\$import_monitor_on_partial_sn is never read, only written\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Inventory/Asset/Monitor.php',
];
$ignoreErrors[] = [
// identifier: property.notFound
'message' => '#^Access to an undefined property object\\:\\:\\$instantiation_type\\.$#',
Expand Down
2 changes: 2 additions & 0 deletions phpunit/functional/Glpi/Inventory/Assets/DriveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public function testPrepare($xml, $expected)
$computer = getItemByTypeName('Computer', '_test_pc01');
$asset = new \Glpi\Inventory\Asset\Drive($computer, $json->content->storages);
$asset->setExtraData((array)$json->content);
$this->assertTrue($asset->checkConf(new \Glpi\Inventory\Conf()));
$result = $asset->prepare();

if (!$asset->isDrive($json->content->storages[0])) {
Expand Down Expand Up @@ -138,6 +139,7 @@ public function testHandle()
$computer = getItemByTypeName('Computer', '_test_pc01');
$asset = new \Glpi\Inventory\Asset\Drive($computer, $json->content->storages);
$asset->setExtraData((array)$json->content);
$this->assertTrue($asset->checkConf(new \Glpi\Inventory\Conf()));
$result = $asset->prepare();
//is a harddrive
$this->assertIsArray($result);
Expand Down
2 changes: 2 additions & 0 deletions phpunit/functional/Glpi/Inventory/Assets/PrinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public function testPrepare($xml, $expected)

$computer = getItemByTypeName('Computer', '_test_pc01');
$asset = new \Glpi\Inventory\Asset\Printer($computer, $json->content->printers);
$conf = new \Glpi\Inventory\Conf();
$this->assertTrue($asset->checkConf($conf));
$asset->setExtraData((array)$json->content);
$result = $asset->prepare();
$this->assertEquals(json_decode($expected), $result[0]);
Expand Down
3 changes: 1 addition & 2 deletions phpunit/functional/Glpi/Inventory/Assets/UnmanagedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,7 @@ public function testState()
$this->assertSame($inv_states_id, $computer->fields['states_id']);

//run discovery
$xml_source = '
<?xml version="1.0" encoding="UTF-8" ?>
$xml_source = '<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
<CONTENT>
<DEVICE>
Expand Down
Loading

0 comments on commit 586e475

Please sign in to comment.