public function testUnderscore() { $tests = array('Foo' => 'foo', 'FooBar' => 'foo_bar', 'FooBarBAZ' => 'foo_bar_baz'); foreach ($tests as $input => $expected) { $this->assertEquals($expected, Str::underscore($input)); } }
/** * Converts from camel case to underscored, i.e. FooBarBaz -> foo_bar_baz * Inspired by Symfony * * @return StrObject */ public function underscore() { $value = Str::underscore($this->value); return new self($value); }