From 663e898ba7fb88f86d4738e5220bd39bb7da1905 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 4 Feb 2014 21:00:52 +0400 Subject: [PATCH] fixed docs, added checks --- docs/guide/console-fixture.md | 8 ++++---- framework/console/controllers/FixtureController.php | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docs/guide/console-fixture.md b/docs/guide/console-fixture.md index d6dc979..c1e2399 100644 --- a/docs/guide/console-fixture.md +++ b/docs/guide/console-fixture.md @@ -62,23 +62,23 @@ Below are correct formats of this command: // load `users` fixture yii fixture/load User -// same as above, because default action of "fixture" command is "apply" +// same as above, because default action of "fixture" command is "load" yii fixture User // load several fixtures. Note that there should not be any whitespace between ",", it should be one string. yii fixture User,UserProfile // load all fixtures -yii fixture/apply all +yii fixture/load all // same as above yii fixture all // load fixtures, but for other database connection. -yii fixtures User --db='customDbConnectionId' +yii fixture User --db='customDbConnectionId' // load fixtures, but search them in different namespace. By default namespace is: tests\unit\fixtures. -yii fixtures User --namespace='alias\my\custom\namespace' +yii fixture User --namespace='alias\my\custom\namespace' // load global fixture `some\name\space\CustomFixture` before other fixtures will be loaded. // By default this option is set to `InitDbFixture` to disable/enable integrity checks. You can specify several diff --git a/framework/console/controllers/FixtureController.php b/framework/console/controllers/FixtureController.php index 6897937..67f2700 100644 --- a/framework/console/controllers/FixtureController.php +++ b/framework/console/controllers/FixtureController.php @@ -33,16 +33,16 @@ use yii\test\FixtureTrait; * * ~~~ * #load fixtures under $fixturePath from UsersFixture class with default namespace "tests\unit\fixtures" - * yii fixture/apply User + * yii fixture/load User * * #also a short version of this command (generate action is default) * yii fixture User * * #load fixtures under $fixturePath with the different database connection - * yii fixture/apply User --db=someOtherDbConnection + * yii fixture/load User --db=someOtherDbConnection * * #load fixtures under different $fixturePath. - * yii fixture/apply User --namespace=alias\my\custom\namespace\goes\here + * yii fixture/load User --namespace=alias\my\custom\namespace\goes\here * ~~~ * * @author Mark Jebri @@ -251,8 +251,10 @@ class FixtureController extends Controller $this->stdout("Fixtures namespace is: \n", Console::FG_YELLOW); $this->stdout("\t" . $this->namespace . "\n\n", Console::FG_GREEN); - $this->stdout("Global fixtures will be loaded:\n\n", Console::FG_YELLOW); - $this->outputList($this->globalFixtures); + if (count($this->globalFixtures)) { + $this->stdout("Global fixtures will be loaded:\n\n", Console::FG_YELLOW); + $this->outputList($this->globalFixtures); + } $this->stdout("\nFixtures below will be loaded:\n\n", Console::FG_YELLOW); $this->outputList($fixtures); @@ -276,8 +278,10 @@ class FixtureController extends Controller $this->stdout("Fixtures namespace is: \n", Console::FG_YELLOW); $this->stdout("\t" . $this->namespace . "\n\n", Console::FG_GREEN); - $this->stdout("Global fixtures will be unloaded:\n\n", Console::FG_YELLOW); - $this->outputList($this->globalFixtures); + if (count($this->globalFixtures)) { + $this->stdout("Global fixtures will be unloaded:\n\n", Console::FG_YELLOW); + $this->outputList($this->globalFixtures); + } $this->stdout("\nFixtures below will be unloaded:\n\n", Console::FG_YELLOW); $this->outputList($fixtures);