function snake_case($string) { return Inflector::snakeCase($string); }
/** * Test that strings are returned as underscored slugs. */ public function testSnakeCase() { $this->assertEquals('camel_case', Inflector::snakeCase('camel Case')); $this->assertEquals('stu_dly_ca_se', Inflector::snakeCase('StuDly CaSe')); $this->assertEquals('title_case', Inflector::snakeCase('Title Case')); $this->assertEquals('normal_case', Inflector::snakeCase('Normal case')); $this->assertEquals('lowercase', Inflector::snakeCase('lowercase')); $this->assertEquals('u_p_p_e_r_c_a_s_e', Inflector::snakeCase('UPPERCASE')); $this->assertEquals('under_score', Inflector::snakeCase('under_score')); $this->assertEquals('dashes', Inflector::snakeCase('dash-es')); $this->assertEquals('123_numbers', Inflector::snakeCase('123 numbers')); $this->assertEquals('with_e_x_txml', Inflector::snakeCase('with EXT.xml')); $this->assertEquals('lots_of_white_space', Inflector::snakeCase('lots of white space')); }