Browse Source

fixed docs, added checks

tags/2.0.0-beta
Mark 11 years ago
parent
commit
663e898ba7
  1. 8
      docs/guide/console-fixture.md
  2. 18
      framework/console/controllers/FixtureController.php

8
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

18
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 <mark.github@yandex.ru>
@ -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);

Loading…
Cancel
Save