public function testSnake() { $this->assertEquals('here_i_am', Strings::snake('Here I am')); $this->assertEquals('here_i_am', Strings::snake('Here-I am')); $this->assertEquals('here_i_am', Strings::snake('Here I am!')); $this->assertEquals('here_i_am', Strings::snake(',Here I am')); $this->assertEquals('here_i_am', Strings::snake(',Here, I am')); $this->assertEquals('me_voila', Strings::snake('Me voilà')); }
public function generate_migration($name, $format = 'php', $pluginName = '') { if (!empty($pluginName)) { $basepath = PluginRegistry::initPlugin($pluginName); } else { $basepath = APP_ROOT; } $file = $basepath . 'db/migrations/' . date('YmdHi') . '_' . Strings::snake($name) . '.' . $format; $classname = Strings::camel($name); $source = file_get_contents(dirname(__FILE__) . '/generate/migration/' . $format . '.tpl'); $source = str_replace('[MIGRATION_NAME]', $classname, $source); file_put_contents($file, $source); $this->line($file . ' created'); }