$plan = 39; $t = new lime_test($plan); if (!extension_loaded('SQLite') && !extension_loaded('pdo_SQLite')) { $t->skip('You need SQLite to run these tests', $plan); return; } $c = new sf_test_project(); $c->initialize($t); // generate:* $content = $c->execute_command('generate:project myproject --orm=Propel'); $t->ok(file_exists($c->tmp_dir.DS.'symfony'), '"generate:project" installs the symfony CLI in root project directory'); $content = $c->execute_command('generate:app frontend'); $t->ok(is_dir($c->tmp_dir.DS.'apps'.DS.'frontend'), '"generate:app" creates a "frontend" directory under "apps" directory'); $t->like(file_get_contents($c->tmp_dir.'/apps/frontend/config/settings.yml'), '/escaping_strategy: +true/', '"generate:app" switches escaping_strategy "on" by default'); $t->like(file_get_contents($c->tmp_dir.'/apps/frontend/config/settings.yml'), '/csrf_secret: +\w+/', '"generate:app" generates a csrf_token by default'); $content = $c->execute_command('generate:app backend --escaping-strategy=false --csrf-secret=false'); $t->like(file_get_contents($c->tmp_dir.'/apps/backend/config/settings.yml'), '/escaping_strategy: +false/', '"generate:app" switches escaping_strategy "false"'); $t->like(file_get_contents($c->tmp_dir.'/apps/backend/config/settings.yml'), '/csrf_secret: +false/', '"generate:app" switches csrf_token to "false"'); // failing $content = $c->execute_command('generate:module wrongapp foo', 1); $content = $c->execute_command('generate:module frontend foo');
return $content; } public function get_fixture_content($file) { return str_replace("\r\n", "\n", file_get_contents(dirname(__FILE__) . '/fixtures/' . $file)); } } $t = new lime_test(40, new lime_output_color()); if (!extension_loaded('SQLite')) { $t->skip('You need SQLite to run these tests', $t->plan); return; } $c = new sf_test_project(); $c->initialize($t); // generate:* $content = $c->execute_command('generate:project myproject'); $t->ok(file_exists($c->tmp_dir . DS . 'symfony'), '"generate:project" installs the symfony CLI in root project directory'); $content = $c->execute_command('generate:app frontend --escaping-strategy=on'); $t->ok(is_dir($c->tmp_dir . DS . 'apps' . DS . 'frontend'), '"generate:app" creates a "frontend" directory under "apps" directory'); $t->like(file_get_contents($c->tmp_dir . '/apps/frontend/config/settings.yml'), '/escaping_strategy: +true/', '"generate:app" switches escaping_strategy "on"'); $content = $c->execute_command('generate:app backend'); $t->like(file_get_contents($c->tmp_dir . '/apps/backend/config/settings.yml'), '/escaping_strategy: +false/', '"generate:app" switches escaping_strategy "off"'); // failing $content = $c->execute_command('generate:module wrongapp foo', 1); $content = $c->execute_command('generate:module frontend foo'); $t->ok(is_dir($c->tmp_dir . DS . 'apps' . DS . 'frontend' . DS . 'modules' . DS . 'foo'), '"generate:module" creates a "foo" directory under "modules" directory'); copy(dirname(__FILE__) . '/fixtures/propel/schema.yml', $c->tmp_dir . DS . 'config' . DS . 'schema.yml'); copy(dirname(__FILE__) . '/fixtures/propel/databases.yml', $c->tmp_dir . DS . 'config' . DS . 'databases.yml'); copy(dirname(__FILE__) . '/fixtures/propel/propel.ini', $c->tmp_dir . DS . 'config' . DS . 'propel.ini'); copy(dirname(__FILE__) . '/fixtures/factories.yml', $c->tmp_dir . DS . 'apps' . DS . 'frontend' . DS . 'config' . DS . 'factories.yml'); // update propel configuration paths
} public function get_fixture_content($file) { return str_replace("\r\n", "\n", file_get_contents(__DIR__ . '/fixtures/' . $file)); } } $plan = 18; $t = new lime_test($plan); if (!extension_loaded('SQLite') && !extension_loaded('pdo_SQLite')) { $t->skip('You need SQLite to run these tests', $plan); return; } $c = new sf_test_project(); $c->initialize($t); // generate:* $content = $c->execute_command('generate:project myproject --orm=Doctrine'); $t->ok(file_exists($c->tmp_dir . DS . 'symfony'), '"generate:project" installs the symfony CLI in root project directory'); $content = $c->execute_command('generate:app frontend'); $t->ok(is_dir($c->tmp_dir . DS . 'apps' . DS . 'frontend'), '"generate:app" creates a "frontend" directory under "apps" directory'); $t->like(file_get_contents($c->tmp_dir . '/apps/frontend/config/settings.yml'), '/escaping_strategy: +true/', '"generate:app" switches escaping_strategy "on" by default'); $t->like(file_get_contents($c->tmp_dir . '/apps/frontend/config/settings.yml'), '/csrf_secret: +\\w+/', '"generate:app" generates a csrf_token by default'); $content = $c->execute_command('generate:app backend --escaping-strategy=false --csrf-secret=false'); $t->like(file_get_contents($c->tmp_dir . '/apps/backend/config/settings.yml'), '/escaping_strategy: +false/', '"generate:app" switches escaping_strategy "false"'); $t->like(file_get_contents($c->tmp_dir . '/apps/backend/config/settings.yml'), '/csrf_secret: +false/', '"generate:app" switches csrf_token to "false"'); // failing $content = $c->execute_command('generate:module wrongapp foo', 1); $content = $c->execute_command('generate:module frontend foo'); $t->ok(is_dir($c->tmp_dir . DS . 'apps' . DS . 'frontend' . DS . 'modules' . DS . 'foo'), '"generate:module" creates a "foo" directory under "modules" directory'); copy(__DIR__ . '/fixtures/factories.yml', $c->tmp_dir . DS . 'apps' . DS . 'frontend' . DS . 'config' . DS . 'factories.yml'); // test:* copy(__DIR__ . '/fixtures/test/unit/testTest.php', $c->tmp_dir . DS . 'test' . DS . 'unit' . DS . 'testTest.php');