/** * @covers Generator::generate_scripts */ function testGenerateScripts() { file_put_contents(vfsStream::url('root/scripts/nimblize'), 'no'); file_put_contents(vfsStream::url('root/scripts/test'), 'yes'); mkdir(vfsStream::url('root/test/scripts'), 0777, true); Generator::$nimble_root = vfsStream::url('root/test'); Generator::generate_scripts(vfsStream::url('root/test/scripts')); $this->assertFileExists(vfsStream::url('root/test/scripts/test')); $this->assertFileNotExists(vfsStream::url('root/test/scripts/nimblize')); }
{ file_put_contents($path, $string); } /** * Retrieve the help documentation. */ public static function help() { return file_get_contents(FileUtils::join(static::$template_path, 'help.tmpl')); } public static function echo_path($type, $path) { if (defined("NIMBLE_IS_TESTING")) { return; } echo CommandLineColor::blue($type) . ': ' . CommandLineColor::yellow($path) . "\n"; } public static function echo_operation($op) { if (defined("NIMBLE_IS_TESTING")) { return; } echo CommandLineColor::underline_white('Generating:') . ' ' . CommandLineColor::red($op) . "\n"; } } foreach (array('template_path' => FileUtils::join(__DIR__, '..', 'templates'), 'script_path' => FileUtils::join(__DIR__, '..', '..', 'nimble_scripts')) as $name => $path) { Generator::${$name} = $path; } if (defined('NIMBLE_ROOT')) { Generator::$nimble_root = NIMBLE_ROOT; }