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
e0bc9f40
Commit
e0bc9f40
authored
Jan 17, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved doc.
parent
bbe33346
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
test-fixture.md
docs/guide/test-fixture.md
+9
-3
No files found.
docs/guide/test-fixture.md
View file @
e0bc9f40
...
...
@@ -135,9 +135,12 @@ being loaded, all its dependent fixtures will be automatically loaded first. In
`UserProfileFixture`
depends on
`UserFixture`
and
`DbFixture`
, when running any test method in the test class,
three fixtures will be loaded sequentially:
`DbFixture`
,
`UserFixture`
and
`UserProfileFixture`
.
When declaring a fixture in a test class, you may assign an alias to a fixture. For example,
`UserProfileFixture`
is aliased as
`profiles`
in the above. In the test methods, you may then access a fixture object using its alias.
For example,
`$this->profiles`
will return the
`UserProfileFixture`
object.
When specifying fixtures in
`fixtures()`
, you may use either a class name or a configuration array to refer to
a fixture. The configuration array will let you customize the fixture properties when the fixture is loaded.
You may also assign an alias to a fixture. In the above example, the
`UserProfileFixture`
is aliased as
`profiles`
.
In the test methods, you may then access a fixture object using its alias. For example,
`$this->profiles`
will
return the
`UserProfileFixture`
object.
Because
`UserProfileFixture`
extends from
`ActiveFixture`
, you may further use the following syntax to access
the data provided by the fixture:
...
...
@@ -150,3 +153,6 @@ $profile = $this->profiles('user1');
// traverse every data row in the fixture
foreach
(
$this
->
profiles
as
$row
)
...
```
> Info: `$this->profiles` is still of `UserProfileFixture` type. The above access features are implemented
> through PHP magic methods.
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