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
5e33a17b
Commit
5e33a17b
authored
Feb 02, 2014
by
Mark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed active fixtures classes
parent
b892ffc8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
5 deletions
+26
-5
ActiveFixture.php
extensions/mongodb/ActiveFixture.php
+14
-3
ActiveFixture.php
framework/test/ActiveFixture.php
+12
-2
No files found.
extensions/mongodb/ActiveFixture.php
View file @
5e33a17b
...
@@ -53,12 +53,12 @@ class ActiveFixture extends BaseActiveFixture
...
@@ -53,12 +53,12 @@ class ActiveFixture extends BaseActiveFixture
/**
/**
* Loads the fixture data.
* Loads the fixture data.
* The default implementation will first reset the DB table and then populate it with the data
* Data will be batch inserted into the given collection.
* returned by [[getData()]].
*/
*/
public
function
load
()
public
function
load
()
{
{
$this
->
resetCollection
();
parent
::
load
();
$data
=
$this
->
getData
();
$data
=
$this
->
getData
();
$this
->
getCollection
()
->
batchInsert
(
$data
);
$this
->
getCollection
()
->
batchInsert
(
$data
);
foreach
(
$data
as
$alias
=>
$row
)
{
foreach
(
$data
as
$alias
=>
$row
)
{
...
@@ -66,6 +66,17 @@ class ActiveFixture extends BaseActiveFixture
...
@@ -66,6 +66,17 @@ class ActiveFixture extends BaseActiveFixture
}
}
}
}
/**
* Unloads the fixture.
*
* The default implementation will clean up the colection by calling [[resetCollection()]].
*/
public
function
unload
()
{
$this
->
resetCollection
();
parent
::
unload
();
}
protected
function
getCollection
()
protected
function
getCollection
()
{
{
return
$this
->
db
->
getCollection
(
$this
->
getCollectionName
());
return
$this
->
db
->
getCollection
(
$this
->
getCollectionName
());
...
...
framework/test/ActiveFixture.php
View file @
5e33a17b
...
@@ -65,7 +65,6 @@ class ActiveFixture extends BaseActiveFixture
...
@@ -65,7 +65,6 @@ class ActiveFixture extends BaseActiveFixture
/**
/**
* Loads the fixture.
* Loads the fixture.
*
*
* The default implementation will first clean up the table by calling [[resetTable()]].
* It will then populate the table with the data returned by [[getData()]].
* It will then populate the table with the data returned by [[getData()]].
*
*
* If you override this method, you should consider calling the parent implementation
* If you override this method, you should consider calling the parent implementation
...
@@ -73,7 +72,7 @@ class ActiveFixture extends BaseActiveFixture
...
@@ -73,7 +72,7 @@ class ActiveFixture extends BaseActiveFixture
*/
*/
public
function
load
()
public
function
load
()
{
{
$this
->
resetTable
();
parent
::
load
();
$table
=
$this
->
getTableSchema
();
$table
=
$this
->
getTableSchema
();
...
@@ -92,6 +91,17 @@ class ActiveFixture extends BaseActiveFixture
...
@@ -92,6 +91,17 @@ class ActiveFixture extends BaseActiveFixture
}
}
/**
/**
* Unloads the fixture.
*
* The default implementation will clean up the table by calling [[resetTable()]].
*/
public
function
unload
()
{
$this
->
resetTable
();
parent
::
unload
();
}
/**
* Returns the fixture data.
* Returns the fixture data.
*
*
* The default implementation will try to return the fixture data by including the external file specified by [[dataFile]].
* The default implementation will try to return the fixture data by including the external file specified by [[dataFile]].
...
...
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