mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* fix: Updated set_null() function to be more useful #6030 * drop isset * Added unit test * change to assertNull
This commit is contained in:
committed by
Tony Murray
parent
b30161b80c
commit
d00a2d6215
@@ -84,6 +84,17 @@ class CommonFunctionsTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('Toner, S/N CR_UM-16021314488.', safedescr($data));
|
||||
}
|
||||
|
||||
public function testSetNull()
|
||||
{
|
||||
$this->assertNull(set_null('BAD-DATA'));
|
||||
$this->assertEquals(0, set_null(0));
|
||||
$this->assertEquals(25, set_null(25));
|
||||
$this->assertEquals(-25, set_null(-25));
|
||||
$this->assertEquals(99, set_null(' ', 99));
|
||||
$this->assertNull(set_null(-25, null, 0));
|
||||
$this->assertEquals(2, set_null(2, 0, 2));
|
||||
}
|
||||
|
||||
public function testIsIp()
|
||||
{
|
||||
$this->assertTrue(is_ip('192.168.0.1'));
|
||||
|
||||
Reference in New Issue
Block a user