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
27738286
Commit
27738286
authored
Feb 03, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed test break.
parent
56f89dd4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
11 deletions
+11
-11
test-fixture.md
docs/guide/test-fixture.md
+1
-1
DbTestCase.php
extensions/codeception/DbTestCase.php
+1
-1
FixtureTrait.php
framework/test/FixtureTrait.php
+4
-4
ActiveFixtureTest.php
tests/unit/framework/test/ActiveFixtureTest.php
+4
-4
FixtureTest.php
tests/unit/framework/test/FixtureTest.php
+1
-1
No files found.
docs/guide/test-fixture.md
View file @
27738286
...
@@ -116,7 +116,7 @@ use app\tests\fixtures\UserProfileFixture;
...
@@ -116,7 +116,7 @@ use app\tests\fixtures\UserProfileFixture;
class
UserProfileTest
extends
DbTestCase
class
UserProfileTest
extends
DbTestCase
{
{
p
rotected
function
fixtures
()
p
ublic
function
fixtures
()
{
{
return
[
return
[
'profiles'
=>
UserProfileFixture
::
className
(),
'profiles'
=>
UserProfileFixture
::
className
(),
...
...
extensions/codeception/DbTestCase.php
View file @
27738286
...
@@ -18,7 +18,7 @@ class DbTestCase extends TestCase
...
@@ -18,7 +18,7 @@ class DbTestCase extends TestCase
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
p
rotected
function
globalFixtures
()
p
ublic
function
globalFixtures
()
{
{
return
[
return
[
InitDbFixture
::
className
(),
InitDbFixture
::
className
(),
...
...
framework/test/FixtureTrait.php
View file @
27738286
...
@@ -61,7 +61,7 @@ trait FixtureTrait
...
@@ -61,7 +61,7 @@ trait FixtureTrait
*
*
* @return array the fixtures needed by the current test case
* @return array the fixtures needed by the current test case
*/
*/
p
rotected
function
fixtures
()
p
ublic
function
fixtures
()
{
{
return
[];
return
[];
}
}
...
@@ -73,7 +73,7 @@ trait FixtureTrait
...
@@ -73,7 +73,7 @@ trait FixtureTrait
* @return array the fixtures shared and required by different test cases.
* @return array the fixtures shared and required by different test cases.
* @see fixtures()
* @see fixtures()
*/
*/
p
rotected
function
globalFixtures
()
p
ublic
function
globalFixtures
()
{
{
return
[];
return
[];
}
}
...
@@ -154,7 +154,7 @@ trait FixtureTrait
...
@@ -154,7 +154,7 @@ trait FixtureTrait
/**
/**
* @return array the loaded fixtures for the current test case
* @return array the loaded fixtures for the current test case
*/
*/
p
rotected
function
getFixtures
()
p
ublic
function
getFixtures
()
{
{
return
$this
->
_fixtures
;
return
$this
->
_fixtures
;
}
}
...
@@ -164,7 +164,7 @@ trait FixtureTrait
...
@@ -164,7 +164,7 @@ trait FixtureTrait
* @param string $name the fixture alias or class name
* @param string $name the fixture alias or class name
* @return Fixture the fixture object, or null if the named fixture does not exist.
* @return Fixture the fixture object, or null if the named fixture does not exist.
*/
*/
p
rotected
function
getFixture
(
$name
)
p
ublic
function
getFixture
(
$name
)
{
{
$class
=
isset
(
$this
->
_fixtureAliases
[
$name
])
?
$this
->
_fixtureAliases
[
$name
]
:
$name
;
$class
=
isset
(
$this
->
_fixtureAliases
[
$name
])
?
$this
->
_fixtureAliases
[
$name
]
:
$name
;
return
isset
(
$this
->
_fixtures
[
$class
])
?
$this
->
_fixtures
[
$class
]
:
null
;
return
isset
(
$this
->
_fixtures
[
$class
])
?
$this
->
_fixtures
[
$class
]
:
null
;
...
...
tests/unit/framework/test/ActiveFixtureTest.php
View file @
27738286
...
@@ -33,14 +33,14 @@ class MyDbTestCase
...
@@ -33,14 +33,14 @@ class MyDbTestCase
$this
->
unloadFixtures
();
$this
->
unloadFixtures
();
}
}
p
rotected
function
fixtures
()
p
ublic
function
fixtures
()
{
{
return
[
return
[
'customers'
=>
CustomerFixture
::
className
(),
'customers'
=>
CustomerFixture
::
className
(),
];
];
}
}
p
rotected
function
globalFixtures
()
p
ublic
function
globalFixtures
()
{
{
return
[
return
[
InitDbFixture
::
className
(),
InitDbFixture
::
className
(),
...
@@ -71,7 +71,7 @@ class ActiveFixtureTest extends DatabaseTestCase
...
@@ -71,7 +71,7 @@ class ActiveFixtureTest extends DatabaseTestCase
{
{
$test
=
new
MyDbTestCase
();
$test
=
new
MyDbTestCase
();
$test
->
setUp
();
$test
->
setUp
();
$fixture
=
$test
->
customers
;
$fixture
=
$test
->
getFixture
(
'customers'
)
;
$this
->
assertEquals
(
CustomerFixture
::
className
(),
get_class
(
$fixture
));
$this
->
assertEquals
(
CustomerFixture
::
className
(),
get_class
(
$fixture
));
$this
->
assertEquals
(
2
,
count
(
$fixture
));
$this
->
assertEquals
(
2
,
count
(
$fixture
));
$this
->
assertEquals
(
1
,
$fixture
[
'customer1'
][
'id'
]);
$this
->
assertEquals
(
1
,
$fixture
[
'customer1'
][
'id'
]);
...
@@ -84,7 +84,7 @@ class ActiveFixtureTest extends DatabaseTestCase
...
@@ -84,7 +84,7 @@ class ActiveFixtureTest extends DatabaseTestCase
{
{
$test
=
new
MyDbTestCase
();
$test
=
new
MyDbTestCase
();
$test
->
setUp
();
$test
->
setUp
();
$fixture
=
$test
->
customers
;
$fixture
=
$test
->
getFixture
(
'customers'
)
;
$this
->
assertEquals
(
Customer
::
className
(),
get_class
(
$fixture
->
getModel
(
'customer1'
)));
$this
->
assertEquals
(
Customer
::
className
(),
get_class
(
$fixture
->
getModel
(
'customer1'
)));
$this
->
assertEquals
(
1
,
$fixture
->
getModel
(
'customer1'
)
->
id
);
$this
->
assertEquals
(
1
,
$fixture
->
getModel
(
'customer1'
)
->
id
);
$this
->
assertEquals
(
'customer1@example.com'
,
$fixture
->
getModel
(
'customer1'
)
->
email
);
$this
->
assertEquals
(
'customer1@example.com'
,
$fixture
->
getModel
(
'customer1'
)
->
email
);
...
...
tests/unit/framework/test/FixtureTest.php
View file @
27738286
...
@@ -78,7 +78,7 @@ class MyTestCase
...
@@ -78,7 +78,7 @@ class MyTestCase
return
$this
->
getFixture
(
$name
);
return
$this
->
getFixture
(
$name
);
}
}
p
rotected
function
fixtures
()
p
ublic
function
fixtures
()
{
{
switch
(
$this
->
scenario
)
{
switch
(
$this
->
scenario
)
{
case
0
:
return
[];
case
0
:
return
[];
...
...
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