Addhost tests (#11385)

* Create addhostCliTest.php

Added test for addhost.php cli tool

* Added test for addhost function

Added tests and fixed code in order for the function to be able to run with default parameter

* Create addhostTest.php

added tests for addhost function

* Update addhostCliTest.php

Changed from testing addhost.php to Artisan command 'device:add'

* remove delhost exec

* remove delhost

* Remove isn't needed, transactions are used.

* Remove unneeded, transactions are used.

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
Lars Elgtvedt Susaas
2020-04-20 00:36:01 +02:00
committed by GitHub
parent cc2894c0df
commit b3d1b97a3b
3 changed files with 240 additions and 4 deletions

View File

@@ -758,9 +758,9 @@ function createHost(
$device = array(
'hostname' => $host,
'overwrite_ip' => $overwrite_ip,
'sysName' => $additional['sysName'] ? $additional['sysName'] : $host,
'os' => $additional['os'] ? $additional['os'] : 'generic',
'hardware' => $additional['hardware'] ? $additional['hardware'] : null,
'sysName' => $additional['sysName'] ?? $host,
'os' => $additional['os'] ?? 'generic',
'hardware' => $additional['hardware'] ?? null,
'community' => $community,
'port' => $port,
'transport' => $transport,
@@ -769,7 +769,7 @@ function createHost(
'poller_group' => $poller_group,
'status_reason' => '',
'port_association_mode' => $port_assoc_mode,
'snmp_disable' => $additional['snmp_disable'] ? $additional['snmp_disable'] : 0,
'snmp_disable' => $additional['snmp_disable'] ?? 0,
);
$device = array_merge($device, $v3); // merge v3 settings