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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
3e58491b
Commit
3e58491b
authored
Aug 17, 2014
by
Mark
Committed by
Qiang Xue
Aug 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed docs
parent
461576dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
test-fixtures.md
docs/guide/test-fixtures.md
+16
-9
No files found.
docs/guide/test-fixtures.md
View file @
3e58491b
...
...
@@ -279,7 +279,8 @@ Loading fixtures
----------------
Fixture classes should be suffixed by
`Fixture`
class. By default fixtures will be searched under
`tests\unit\fixtures`
namespace, you can
change this behavior with config or command options.
change this behavior with config or command options. Note that you can also append fixtures data to already existing ones with command
option
`--append`
. You can exclude some fixtures due load or unload by specifying
`-`
before its name like
`-User`
.
To load fixture, run the following command:
...
...
@@ -291,14 +292,17 @@ The required `fixture_name` parameter specifies a fixture name which data will b
Below are correct formats of this command:
```
// load `
users
` fixture
// load `
User
` fixture
yii fixture/load User
// 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 several fixtures
yii fixture User UserProfile
//load fixture, but dont clean storage before load and just append to already existed data
yii fixture User --append
// load all fixtures
yii fixture/load all
...
...
@@ -306,8 +310,8 @@ yii fixture/load all
// same as above
yii fixture all
// load
fixtures, but for other database connection.
yii fixture
User --db='customDbConnectionId'
// load
all fixtures except ones
yii fixture
all -DoNotLoadThisOne
// load fixtures, but search them in different namespace. By default namespace is: tests\unit\fixtures.
yii fixture User --namespace='alias\my\custom\namespace'
...
...
@@ -327,14 +331,18 @@ To unload fixture, run the following command:
// unload Users fixture, by default it will clear fixture storage (for example "users" table, or "users" collection if this is mongodb fixture).
yii fixture/unload User
// Unload several fixtures
. Note that there should not be any whitespace between ",", it should be one string.
// Unload several fixtures
yii fixture/unload User,UserProfile
// unload all fixtures
yii fixture/unload all
// unload all fixtures except ones
yii fixture/unload all -DoNotUnloadThisOne
```
Same command options like:
`
db`
,
`
namespace`
,
`globalFixtures`
also can be applied to this command.
Same command options like:
`namespace`
,
`globalFixtures`
also can be applied to this command.
Configure Command Globally
--------------------------
...
...
@@ -346,7 +354,6 @@ different migration path as follows:
'controllerMap' => [
'fixture' => [
'class' => 'yii\console\controllers\FixtureController',
'db' => 'customDbConnectionId',
'namespace' => 'myalias\some\custom\namespace',
'globalFixtures' => [
'some\name\space\Foo',
...
...
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