Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
19af2645
Commit
19af2645
authored
Nov 28, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enh: `yii fixture` command now offers help if no arguments are provided instead of crashing
parent
7325fdd7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
FixtureController.php
extensions/faker/FixtureController.php
+5
-5
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
FixtureController.php
framework/console/controllers/FixtureController.php
+9
-0
No files found.
extensions/faker/FixtureController.php
View file @
19af2645
...
...
@@ -14,13 +14,13 @@ use yii\helpers\FileHelper;
use
yii\helpers\VarDumper
;
/**
* This command
manage fixtures creations based on
given template.
* This command
creates fixtures based on a
given template.
*
* Fixtures are one of the important paths in unit testing. To speed up developers
* work these fixtures can be generated automatically, based on prepared template.
* This command is a simple wrapper for the
fixtures library [Faker](https://github.com/fzaninotto/Faker)
.
* This command is a simple wrapper for the
[Faker](https://github.com/fzaninotto/Faker) library
.
*
* You should configure
this command
as follows (you can use any alias, not only "fixture"):
* You should configure
your application
as follows (you can use any alias, not only "fixture"):
*
* ~~~
* 'controllerMap' => [
...
...
@@ -30,7 +30,7 @@ use yii\helpers\VarDumper;
* ],
* ~~~
*
* To start using th
is command you need to be familiar (read guide) for
the Faker library and
* To start using th
e command you need to be familiar (read guide) with
the Faker library and
* generate fixtures template files, according to the given format:
*
* ```php
...
...
@@ -45,7 +45,7 @@ use yii\helpers\VarDumper;
* ];
* ```
*
* If you use callback as a
attribute value, then it will be called as shown with
three parameters:
* If you use callback as a
n attribute value it will be called with the following
three parameters:
*
* - `$faker`: the Faker generator instance
* - `$index`: the current fixture index. For example if user need to generate 3 fixtures for user table, it will be 0..2.
...
...
framework/CHANGELOG.md
View file @
19af2645
...
...
@@ -71,6 +71,7 @@ Yii Framework 2 Change Log
-
Enh:
`Console::confirm()`
now uses
`Console::stdout()`
instead of
`echo`
to be consistent with all other functions (cebe)
-
Enh:
`yii\rbac\DbManager`
migration now uses database component specified in component settings instead of always using default
`db`
(samdark)
-
Enh: Added
`yii\base\Controller::renderContent()`
(qiangxue)
-
Enh:
`yii fixture`
command now offers help if no arguments are provided instead of crashing (samdark)
-
Chg #3630:
`yii\db\Command::queryInternal()`
is now protected (samdark)
-
Chg #4277:
`yii\grid\GridView`
is no longer throwing an exception when results are empty and
`columns`
aren't defined (samdark)
-
Chg #5508: Dropped the support for the
`--append`
option for the
`fixture`
command (qiangxue)
...
...
framework/console/controllers/FixtureController.php
View file @
19af2645
...
...
@@ -91,6 +91,15 @@ class FixtureController extends Controller
public
function
actionLoad
()
{
$fixturesInput
=
func_get_args
();
if
(
$fixturesInput
===
[])
{
$this
->
stdout
(
$this
->
getHelpSummary
()
.
"
\n
"
);
$helpCommand
=
Console
::
ansiFormat
(
"yii help fixture"
,
[
Console
::
FG_CYAN
]);
$this
->
stdout
(
"Use
$helpCommand
to get usage info.
\n
"
);
return
self
::
EXIT_CODE_NORMAL
;
}
$filtered
=
$this
->
filterFixtures
(
$fixturesInput
);
$except
=
$filtered
[
'except'
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment