01.14 php saved
kabturek
Tags add more
bake and tests  
Note
console/libs/bake.php diff that adds baking only tests for mode/controller
  1. Index: libs/bake.php
  2. ===================================================================
  3. --- libs/bake.php   (revision 6377)
  4. +++ libs/bake.php   (working copy)
  5. @@ -110,7 +110,61 @@
  6.        $this->hr();
  7.        $this->main();
  8.     }
  9. +
  10.  /**
  11. + * Quickly bake unit tests
  12. + *
  13. + * @access public
  14. + */
  15. +   function tests() {
  16. +      $ds = 'default';
  17. +      $this->hr();
  18. +      $this->out('Bake Unit Tests');
  19. +      $this->hr();
  20. +
  21. +      if (isset($this->params['connection'])) {
  22. +         $ds = $this->params['connection'];
  23. +      }
  24. +
  25. +      if (empty($this->args)) {
  26. +         $name = $this->Model->getName($ds);
  27. +      }
  28. +
  29. +      if (!empty($this->args[0])) {
  30. +         $name = $this->args[0];
  31. +         $this->Model->listAll($ds, false);
  32. +      }
  33. +
  34. +      $modelExists = false;
  35. +      $model = $this->_modelName($name);
  36. +      if (App::import('Model', $model)) {
  37. +         $object = new $model();
  38. +         $modelExists = true;
  39. +      } else {
  40. +         $this->out(__('Model doesn\'t exist. Please create it first.'));
  41. +      }
  42. +      if ($modelExists === true) {
  43. +         if ($this->_checkUnitTest()) {
  44. +            $this->Model->bakeTest($model);
  45. +            $this->out(__('Baked model unit test.'));
  46. +         }
  47. +         $controller = $this->_controllerName($name);
  48. +         if (App::import('Controller', $controller)) {
  49. +            if ($this->_checkUnitTest()) {
  50. +               $this->Controller->bakeTest($controller);
  51. +               $this->out(__('Baked controller unit test.'));
  52. +            }
  53. +         }
  54. +      } else {
  55. +         $this->err(__('Bake All could not continue without a valid model', true));
  56. +      }
  57. +      if (empty($this->args)) {
  58. +         $this->tests();
  59. +      }
  60. +      exit();
  61. +   }
  62. +
  63. +/**
  64.   * Quickly bake the MVC
  65.   *
  66.   * @access public
  67. @@ -206,4 +260,4 @@
  68.  
  69.    }
  70. }
  71. -?>
  72. \ No newline at end of file
  73. +?>
  74.  
Parsed in 0.075 seconds, using GeSHi 1.0.7.14

Modify this Paste