mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Updated function + added unit test
This commit is contained in:
@@ -492,7 +492,7 @@ function safename($name)
|
||||
|
||||
function safedescr($descr)
|
||||
{
|
||||
return safename($descr);
|
||||
return preg_replace('/[^a-zA-Z0-9,._\-\/\ ]/', ' ', $descr);
|
||||
}
|
||||
|
||||
function zeropad($num, $length = 2)
|
||||
|
@@ -77,4 +77,11 @@ class CommonFunctionsTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue(ends_with($data, array('this', 'tesTing', 'no'), true));
|
||||
$this->assertFalse(ends_with($data, array('this', 'Test'), true));
|
||||
}
|
||||
|
||||
public function testRrdDescriptions()
|
||||
{
|
||||
$data = 'Toner S/N:CRUM-1';
|
||||
|
||||
$this->assertEquals('Toner S/N CRUM-1', safedescr($data));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user