mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Adding some additional output to bake tasks to make them more consistent. Adding flags for Quiet output so the shells give minimal output.
This commit is contained in:
parent
d373dde2ef
commit
d7b1f70680
7 changed files with 11 additions and 10 deletions
|
@ -162,8 +162,6 @@ class BakeShell extends Shell {
|
|||
$modelBaked = $this->Model->bake($object, false);
|
||||
|
||||
if ($modelBaked && $modelExists === false) {
|
||||
$this->out(sprintf(__('%s Model was baked.'), $model));
|
||||
|
||||
if ($this->_checkUnitTest()) {
|
||||
$this->Model->bakeFixture($model);
|
||||
$this->Model->bakeTest($model);
|
||||
|
@ -173,7 +171,6 @@ class BakeShell extends Shell {
|
|||
|
||||
if ($modelExists === true) {
|
||||
$controller = $this->_controllerName($name);
|
||||
$this->out(sprintf(__('Baking %s Controller...', 1), $controller));
|
||||
if ($this->Controller->bake($controller, $this->Controller->bakeActions($controller))) {
|
||||
if ($this->_checkUnitTest()) {
|
||||
$this->Controller->bakeTest($controller);
|
||||
|
@ -182,9 +179,9 @@ class BakeShell extends Shell {
|
|||
if (App::import('Controller', $controller)) {
|
||||
$this->View->args = array($controller);
|
||||
$this->View->execute();
|
||||
$this->out(sprintf(__('%s Views were baked.'), $controller));
|
||||
}
|
||||
$this->out(__('Bake All complete'));
|
||||
$this->out('', 1, Shell::QUIET);
|
||||
$this->out(__('<success>Bake All complete</success>'), 1, Shell::QUIET);
|
||||
array_shift($this->args);
|
||||
} else {
|
||||
$this->error(__('Bake All could not continue without a valid model'));
|
||||
|
|
|
@ -302,6 +302,8 @@ class ControllerTask extends BakeTask {
|
|||
* @return string Baked controller
|
||||
*/
|
||||
public function bake($controllerName, $actions = '', $helpers = null, $components = null) {
|
||||
$this->out("\nBaking controller class for $controllerName...", 1, Shell::QUIET);
|
||||
|
||||
$isScaffold = ($actions === 'scaffold') ? true : false;
|
||||
|
||||
$this->Template->set('plugin', Inflector::camelize($this->plugin));
|
||||
|
|
|
@ -254,7 +254,7 @@ class FixtureTask extends BakeTask {
|
|||
$this->Template->set($vars);
|
||||
$content = $this->Template->generate('classes', 'fixture');
|
||||
|
||||
$this->out("\nBaking test fixture for $model...");
|
||||
$this->out("\nBaking test fixture for $model...", 1, Shell::QUIET);
|
||||
$this->createFile($path . $filename, $content);
|
||||
return $content;
|
||||
}
|
||||
|
|
|
@ -742,7 +742,7 @@ class ModelTask extends BakeTask {
|
|||
|
||||
$path = $this->getPath();
|
||||
$filename = $path . Inflector::underscore($name) . '.php';
|
||||
$this->out("\nBaking model class for $name...");
|
||||
$this->out("\nBaking model class for $name...", 1, Shell::QUIET);
|
||||
$this->createFile($filename, $out);
|
||||
ClassRegistry::flush();
|
||||
return $out;
|
||||
|
|
|
@ -115,7 +115,7 @@ class TestTask extends BakeTask {
|
|||
*/
|
||||
public function bake($type, $className) {
|
||||
if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) {
|
||||
$this->out(__('Bake is detecting possible fixtures..'));
|
||||
$this->out(__('Bake is detecting possible fixtures...'));
|
||||
$testSubject = $this->buildTestSubject($type, $className);
|
||||
$this->generateFixtureList($testSubject);
|
||||
} elseif ($this->interactive) {
|
||||
|
@ -134,6 +134,7 @@ class TestTask extends BakeTask {
|
|||
if ($this->plugin) {
|
||||
$plugin = $this->plugin . '.';
|
||||
}
|
||||
$this->out("\nBaking test case for $className $type...", 1, Shell::QUIET);
|
||||
|
||||
$this->Template->set('fixtures', $this->_fixtures);
|
||||
$this->Template->set('plugin', $plugin);
|
||||
|
|
|
@ -366,6 +366,7 @@ class ViewTask extends BakeTask {
|
|||
if (empty($content)) {
|
||||
return false;
|
||||
}
|
||||
$this->out("\nBaking `$action` view file...", 1, Shell::QUIET);
|
||||
$path = $this->getPath();
|
||||
$filename = $path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp';
|
||||
return $this->createFile($filename, $content);
|
||||
|
|
|
@ -304,11 +304,11 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
|
||||
$path = APP . 'plugins' . DS . 'controller_test' . DS . 'controllers' . DS . 'articles_controller.php';
|
||||
|
||||
$this->Task->expects($this->at(0))->method('createFile')->with(
|
||||
$this->Task->expects($this->at(1))->method('createFile')->with(
|
||||
$path,
|
||||
new PHPUnit_Framework_Constraint_IsAnything()
|
||||
);
|
||||
$this->Task->expects($this->at(1))->method('createFile')->with(
|
||||
$this->Task->expects($this->at(3))->method('createFile')->with(
|
||||
$path,
|
||||
new PHPUnit_Framework_Constraint_PCREMatch('/ArticlesController extends ControllerTestAppController/')
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue