Browse files

Removing garbage methods.

  • Loading branch information...
1 parent 3d39fee commit 928ec36acf29ad73290f2bc285abf721b20c2187 @markstory markstory committed Jun 5, 2009
Showing with 0 additions and 112 deletions.
  1. +0 −112 cake/console/libs/tasks/test.php
View
112 cake/console/libs/tasks/test.php
@@ -400,117 +400,5 @@ function generateConstructor($type, $fullClassName) {
}
return "new $fullClassName()\n";
}
-
-/**
- * Handles the extra stuff needed
- *
- * @access private
- */
- function __extras($class) {
- $extras = null;
- switch ($class) {
- case 'Model':
- $extras = "\n\tvar \$cacheSources = false;";
- $extras .= "\n\tvar \$useDbConfig = 'test_suite';\n";
- break;
- }
- return $extras;
- }
-
-/**
- * Create a test for a Model object.
- *
- * @return void
- **/
- function bakeModelTest($className) {
- $fixtureInc = 'app';
- if ($this->plugin) {
- $fixtureInc = 'plugin.'.Inflector::underscore($this->plugin);
- }
-
- $fixture[] = "'{$fixtureInc}." . Inflector::underscore($className) ."'";
-
- if (!empty($associations)) {
- $assoc[] = Set::extract($associations, 'belongsTo.{n}.className');
- $assoc[] = Set::extract($associations, 'hasOne.{n}.className');
- $assoc[] = Set::extract($associations, 'hasMany.{n}.className');
- foreach ($assoc as $key => $value) {
- if (is_array($value)) {
- foreach ($value as $class) {
- $fixture[] = "'{$fixtureInc}." . Inflector::underscore($class) ."'";
- }
- }
- }
- }
- $fixture = join(", ", $fixture);
-
- $import = $className;
- if (isset($this->plugin)) {
- $import = $this->plugin . '.' . $className;
- }
-
- $out = "App::import('Model', '$import');\n\n";
- $out .= "class {$className}TestCase extends CakeTestCase {\n";
- $out .= "\tvar \${$className} = null;\n";
- $out .= "\tvar \$fixtures = array($fixture);\n\n";
- $out .= "\tfunction startTest() {\n";
- $out .= "\t\t\$this->{$className} =& ClassRegistry::init('{$className}');\n";
- $out .= "\t}\n\n";
- $out .= "\tfunction endTest() {\n";
- $out .= "\t\tunset(\$this->{$className});\n";
- $out .= "\t}\n\n";
- $out .= "\tfunction test{$className}Instance() {\n";
- $out .= "\t\t\$this->assertTrue(is_a(\$this->{$className}, '{$className}'));\n";
- $out .= "\t}\n\n";
- $out .= "}\n";
-
- $path = MODEL_TESTS;
- if (isset($this->plugin)) {
- $pluginPath = 'plugins' . DS . Inflector::underscore($this->plugin) . DS;
- $path = APP . $pluginPath . 'tests' . DS . 'cases' . DS . 'models' . DS;
- }
-
- $filename = Inflector::underscore($className).'.test.php';
- $this->out("\nBaking unit test for $className...");
-
- $header = '$Id';
- $content = "<?php \n/* SVN FILE: $header$ */\n/* ". $className ." Test cases generated on: " . date('Y-m-d H:m:s') . " : ". time() . "*/\n{$out}?>";
- return $this->createFile($path . $filename, $content);
- }
-
-/**
- * Create a test case for a controller.
- *
- * @return void
- **/
- function bakeControllerTest() {
- $import = $className;
- if ($this->plugin) {
- $import = $this->plugin . '.' . $className;
- }
- $out = "App::import('Controller', '$import');\n\n";
- $out .= "class Test{$className} extends {$className}Controller {\n";
- $out .= "\tvar \$autoRender = false;\n}\n\n";
- $out .= "class {$className}ControllerTest extends CakeTestCase {\n";
- $out .= "\tvar \${$className} = null;\n\n";
- $out .= "\tfunction startTest() {\n\t\t\$this->{$className} = new Test{$className}();";
- $out .= "\n\t\t\$this->{$className}->constructClasses();\n\t}\n\n";
- $out .= "\tfunction test{$className}ControllerInstance() {\n";
- $out .= "\t\t\$this->assertTrue(is_a(\$this->{$className}, '{$className}Controller'));\n\t}\n\n";
- $out .= "\tfunction endTest() {\n\t\tunset(\$this->{$className});\n\t}\n}\n";
-
- $path = CONTROLLER_TESTS;
- if (isset($this->plugin)) {
- $pluginPath = 'plugins' . DS . Inflector::underscore($this->plugin) . DS;
- $path = APP . $pluginPath . 'tests' . DS . 'cases' . DS . 'controllers' . DS;
- }
-
- $filename = Inflector::underscore($className).'_controller.test.php';
- $this->out("\nBaking unit test for $className...");
-
- $header = '$Id';
- $content = "<?php \n/* SVN FILE: $header$ */\n/* ". $className ."Controller Test cases generated on: " . date('Y-m-d H:m:s') . " : ". time() . "*/\n{$out}?>";
- return $this->createFile($path . $filename, $content);
- }
}
?>

0 comments on commit 928ec36

Please sign in to comment.