Remove unused functions (#15371)

* Remove unused functions
inline other legacy functions

* Apply fixes from StyleCI

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
This commit is contained in:
Tony Murray
2023-10-04 10:17:34 -05:00
committed by GitHub
parent 3366ecad39
commit 4211b1c46f
24 changed files with 78 additions and 282 deletions

View File

@@ -29,6 +29,7 @@ use Illuminate\Support\Str;
use LibreNMS\Config;
use LibreNMS\Enum\PortAssociationMode;
use LibreNMS\Util\Clean;
use LibreNMS\Util\StringHelpers;
use LibreNMS\Util\Validate;
class CommonFunctionsTest extends TestCase
@@ -106,11 +107,11 @@ class CommonFunctionsTest extends TestCase
public function testStringToClass(): void
{
$this->assertSame('LibreNMS\OS\Os', str_to_class('OS', 'LibreNMS\\OS\\'));
$this->assertSame('SpacesName', str_to_class('spaces name'));
$this->assertSame('DashName', str_to_class('dash-name'));
$this->assertSame('UnderscoreName', str_to_class('underscore_name'));
$this->assertSame('LibreNMS\\AllOfThemName', str_to_class('all OF-thEm_NaMe', 'LibreNMS\\'));
$this->assertSame('LibreNMS\OS\Os', StringHelpers::toClass('OS', 'LibreNMS\\OS\\'));
$this->assertSame('SpacesName', StringHelpers::toClass('spaces name', null));
$this->assertSame('DashName', StringHelpers::toClass('dash-name', null));
$this->assertSame('UnderscoreName', StringHelpers::toClass('underscore_name', null));
$this->assertSame('LibreNMS\\AllOfThemName', StringHelpers::toClass('all OF-thEm_NaMe', 'LibreNMS\\'));
}
public function testIsValidHostname(): void

View File

@@ -31,6 +31,7 @@ use Illuminate\Foundation\Testing\DatabaseTransactions;
use LibreNMS\Config;
use LibreNMS\Enum\Severity;
use LibreNMS\Tests\Traits\RequiresDatabase;
use LibreNMS\Util\AutonomousSystem;
class BgpTrapTest extends SnmpTrapTestCase
{
@@ -53,7 +54,7 @@ DISMAN-EVENT-MIB::sysUpTimeInstance 302:12:56:24.81
SNMPv2-MIB::snmpTrapOID.0 BGP4-MIB::bgpEstablished
BGP4-MIB::bgpPeerLastError.$bgppeer->bgpPeerIdentifier \"04 00 \"
BGP4-MIB::bgpPeerState.$bgppeer->bgpPeerIdentifier established\n",
"SNMP Trap: BGP Up $bgppeer->bgpPeerIdentifier " . get_astext($bgppeer->bgpPeerRemoteAs) . ' is now established',
"SNMP Trap: BGP Up $bgppeer->bgpPeerIdentifier " . AutonomousSystem::get($bgppeer->bgpPeerRemoteAs)->name() . ' is now established',
'Could not handle bgpEstablished',
[Severity::Ok, 'bgpPeer', $bgppeer->bgpPeerIdentifier],
$device,
@@ -79,7 +80,7 @@ DISMAN-EVENT-MIB::sysUpTimeInstance 302:12:55:33.47
SNMPv2-MIB::snmpTrapOID.0 BGP4-MIB::bgpBackwardTransition
BGP4-MIB::bgpPeerLastError.$bgppeer->bgpPeerIdentifier \"04 00 \"
BGP4-MIB::bgpPeerState.$bgppeer->bgpPeerIdentifier idle\n",
"SNMP Trap: BGP Down $bgppeer->bgpPeerIdentifier " . get_astext($bgppeer->bgpPeerRemoteAs) . ' is now idle',
"SNMP Trap: BGP Down $bgppeer->bgpPeerIdentifier " . AutonomousSystem::get($bgppeer->bgpPeerRemoteAs)->name() . ' is now idle',
'Could not handle bgpBackwardTransition',
[Severity::Error, 'bgpPeer', $bgppeer->bgpPeerIdentifier],
$device,