01.14
php
saved
kabturek
Note
console/libs/bake.php diff that adds baking only tests for mode/controller
console/libs/bake.php diff that adds baking only tests for mode/controller
- Index: libs/bake.php
- ===================================================================
- --- libs/bake.php (revision 6377)
- @@ -110,7 +110,61 @@
- $this->hr();
- $this->main();
- }
- +
- /**
- + * Quickly bake unit tests
- + *
- + * @access public
- + */
- + function tests() {
- + $ds = 'default';
- + $this->hr();
- + $this->out('Bake Unit Tests');
- + $this->hr();
- +
- + $ds = $this->params['connection'];
- + }
- +
- + $name = $this->Model->getName($ds);
- + }
- +
- + $name = $this->args[0];
- + $this->Model->listAll($ds, false);
- + }
- +
- + $modelExists = false;
- + $model = $this->_modelName($name);
- + if (App::import('Model', $model)) {
- + $object = new $model();
- + $modelExists = true;
- + } else {
- + $this->out(__('Model doesn\'t exist. Please create it first.'));
- + }
- + if ($modelExists === true) {
- + if ($this->_checkUnitTest()) {
- + $this->Model->bakeTest($model);
- + $this->out(__('Baked model unit test.'));
- + }
- + $controller = $this->_controllerName($name);
- + if (App::import('Controller', $controller)) {
- + if ($this->_checkUnitTest()) {
- + $this->Controller->bakeTest($controller);
- + $this->out(__('Baked controller unit test.'));
- + }
- + }
- + } else {
- + $this->err(__('Bake All could not continue without a valid model', true));
- + }
- + $this->tests();
- + }
- + }
- +
- +/**
- * Quickly bake the MVC
- *
- * @access public
- @@ -206,4 +260,4 @@
- }
- }
- -?>
- \ No newline at end of file
- +?>
- Parsed in 0.075 seconds, using GeSHi 1.0.7.14