예제 #1
0
파일: StringsTest.php 프로젝트: demental/m
 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à'));
 }
예제 #2
0
파일: generate.php 프로젝트: demental/m
 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');
 }