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
9140a012
Commit
9140a012
authored
Sep 20, 2011
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10 from colinmollenhour/modulefixtures3
Added @colinmollenhour pull request for shared fixtures.
parents
4417a0e5
819d5251
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
app/code/community/EcomDev/PHPUnit/Test/Case.php
app/code/community/EcomDev/PHPUnit/Test/Case.php
+19
-4
No files found.
app/code/community/EcomDev/PHPUnit/Test/Case.php
View file @
9140a012
...
...
@@ -743,7 +743,9 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
}
/**
* Loads YAML file from directory inside of the unit test class
* Loads YAML file from directory inside of the unit test class or
* the directory inside the module directory if name is prefixed with ~/
* or from another module if name is prefixed with ~My_Module/
*
* @param string $className class name for looking fixture files
* @param string $type type of YAML data (fixtures,expectations,dataproviders)
...
...
@@ -760,9 +762,22 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
EcomDev_Utils_Reflection
::
getRelflection
(
$className
)
->
getFileName
()
);
// When prefixed with ~/ or ~My_Module/, load from the module's Test/<type> directory
if
(
preg_match
(
'#^~(?<module>[^/]*)/(?<path>.*)$#'
,
$name
,
$matches
))
{
$name
=
$matches
[
'path'
];
if
(
!
empty
(
$matches
[
'module'
]))
{
$moduleName
=
$matches
[
'module'
];
}
else
{
$moduleName
=
substr
(
$className
,
0
,
strpos
(
$className
,
'_Test_'
));;
}
$filePath
=
Mage
::
getModuleDir
(
''
,
$moduleName
)
.
DS
.
'Test'
.
DS
;
}
// Otherwise load from the Class/<type> directory
else
{
$filePath
=
$classFileObject
->
getPath
()
.
DS
.
$classFileObject
->
getBasename
(
'.php'
)
.
DS
.
$type
.
DS
.
$name
;
.
$classFileObject
->
getBasename
(
'.php'
)
.
DS
;
}
$filePath
.=
$type
.
DS
.
$name
;
if
(
file_exists
(
$filePath
))
{
return
$filePath
;
...
...
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