Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EcomDev_PHPUnit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Open
EcomDev_PHPUnit
Commits
7db1bed0
Commit
7db1bed0
authored
Aug 26, 2014
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #197 from fooman/load-shared-class-fixtures-before-methods2
Load shared class fixtures before methods
parents
c6a03a8d
0f1e60a6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
+1
-1
app/code/community/EcomDev/PHPUnitTest/Test/Model/Fixture.php
...code/community/EcomDev/PHPUnitTest/Test/Model/Fixture.php
+15
-4
No files found.
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
View file @
7db1bed0
...
@@ -301,7 +301,7 @@ class EcomDev_PHPUnit_Model_Fixture
...
@@ -301,7 +301,7 @@ class EcomDev_PHPUnit_Model_Fixture
public
function
loadByTestCase
(
PHPUnit_Framework_TestCase
$testCase
)
public
function
loadByTestCase
(
PHPUnit_Framework_TestCase
$testCase
)
{
{
$fixtures
=
EcomDev_PHPUnit_Test_Case_Util
::
getAnnotationByNameFromClass
(
$fixtures
=
EcomDev_PHPUnit_Test_Case_Util
::
getAnnotationByNameFromClass
(
get_class
(
$testCase
),
'loadFixture'
,
array
(
'
class'
,
'method
'
),
$testCase
->
getName
(
false
)
get_class
(
$testCase
),
'loadFixture'
,
array
(
'
method'
,
'class
'
),
$testCase
->
getName
(
false
)
);
);
$this
->
_loadFixtureFiles
(
$fixtures
,
$testCase
);
$this
->
_loadFixtureFiles
(
$fixtures
,
$testCase
);
...
...
app/code/community/EcomDev/PHPUnitTest/Test/Model/Fixture.php
View file @
7db1bed0
<?php
<?php
/**
* @loadSharedFixture testFixtureArrayMerge.yaml
*/
class
EcomDev_PHPUnitTest_Test_Model_Fixture
extends
EcomDev_PHPUnit_Test_Case
class
EcomDev_PHPUnitTest_Test_Model_Fixture
extends
EcomDev_PHPUnit_Test_Case
{
{
/**
* @loadFixture testFixtureArrayMerge.yaml
*/
public
function
testFixtureArrayMerge
()
public
function
testFixtureArrayMerge
()
{
{
require_once
(
$this
->
_getVfsUrl
(
'app/code/community/EcomDev/PHPUnit/Test/Model/ExampleClass.php'
));
require_once
(
$this
->
_getVfsUrl
(
'app/code/community/EcomDev/PHPUnit/Test/Model/ExampleClass.php'
));
...
@@ -17,6 +16,18 @@ class EcomDev_PHPUnitTest_Test_Model_Fixture extends EcomDev_PHPUnit_Test_Case
...
@@ -17,6 +16,18 @@ class EcomDev_PHPUnitTest_Test_Model_Fixture extends EcomDev_PHPUnit_Test_Case
$this
->
getFixture
()
->
apply
();
$this
->
getFixture
()
->
apply
();
}
}
public
function
testLoadClassBeforeMethodFixtures
()
{
require_once
(
$this
->
_getVfsUrl
(
'app/code/community/EcomDev/PHPUnit/Test/Model/ExampleClass.php'
));
$testCase
=
new
EcomDev_PHPUnitTest_Test_Model_ExampleClass
();
$testCase
->
setName
(
'testLoadFixtureOrder'
);
$this
->
getFixture
()
->
loadForClass
(
get_class
(
$testCase
));
$this
->
getFixture
()
->
loadByTestCase
(
$testCase
);
$this
->
getFixture
()
->
apply
();
$this
->
assertEquals
(
'methodFixtureValue'
,
Mage
::
getStoreConfig
(
'sample/path'
));
}
protected
function
_getVfsUrl
(
$path
)
protected
function
_getVfsUrl
(
$path
)
{
{
return
$this
->
getFixture
()
->
getVfs
()
->
url
(
$path
);
return
$this
->
getFixture
()
->
getVfs
()
->
url
(
$path
);
...
...
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