/** * Tests sanitize function */ public function testSanitize() { $values = ['normal_value' => 'normal_value', 'should.be.sanitized' => 'should_be_sanitized', 'Normal_CaseSensitive' => 'Normal_CaseSensitive', 'S@n1TiZ3.M*.Hard' => 'S_n1TiZ3_M_Hard']; foreach ($values as $source => $result) { $sanitized = Helper::sanitize($source); $this->assertEquals($result, $sanitized); } }
/** * Sets metric name. * The name will be sanitized using `Helper::sanitize` function. * * @param string $name * @return $this */ public function setName($name) { $this->name = Helper::sanitize($name); return $this; }