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
cdfc200a
Commit
cdfc200a
authored
Oct 26, 2013
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix VFS file stream and improve bootstrap process of EcomDev PHPUnit extension
parent
271a7c30
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
22 deletions
+32
-22
.travis/composer.json
.travis/composer.json
+2
-1
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
+2
-1
app/code/community/EcomDev/PHPUnit/Model/Fixture/Vfs.php
app/code/community/EcomDev/PHPUnit/Model/Fixture/Vfs.php
+8
-10
app/code/community/EcomDev/PHPUnit/bootstrap.php
app/code/community/EcomDev/PHPUnit/bootstrap.php
+20
-9
lib/EcomDev/PHPUnit/Constraint/Config/Resource/Script.php
lib/EcomDev/PHPUnit/Constraint/Config/Resource/Script.php
+0
-1
No files found.
.travis/composer.json
View file @
cdfc200a
{
{
"require"
:
{
"require"
:
{
"ecomdev/mage-ci"
:
"*"
"ecomdev/mage-ci"
:
"*"
,
"mikey179/vfsStream"
:
"*"
},
},
"config"
:
{
"config"
:
{
"bin-dir"
:
"bin"
"bin-dir"
:
"bin"
...
...
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
View file @
cdfc200a
...
@@ -737,7 +737,8 @@ class EcomDev_PHPUnit_Model_Fixture
...
@@ -737,7 +737,8 @@ class EcomDev_PHPUnit_Model_Fixture
return
$this
->
_vfs
;
return
$this
->
_vfs
;
}
}
if
(
is_dir
(
Mage
::
getBaseDir
(
'lib'
)
.
DS
.
'vfsStream'
.
DS
.
'src'
))
{
if
(
!
class_exists
(
'\org\bovigo\vfs\vfsStream'
)
&&
is_dir
(
Mage
::
getBaseDir
(
'lib'
)
.
DS
.
'vfsStream'
.
DS
.
'src'
))
{
spl_autoload_register
(
array
(
$this
,
'vfsAutoload'
),
true
,
true
);
spl_autoload_register
(
array
(
$this
,
'vfsAutoload'
),
true
,
true
);
}
}
...
...
app/code/community/EcomDev/PHPUnit/Model/Fixture/Vfs.php
View file @
cdfc200a
...
@@ -35,14 +35,6 @@ class EcomDev_PHPUnit_Model_Fixture_Vfs
...
@@ -35,14 +35,6 @@ class EcomDev_PHPUnit_Model_Fixture_Vfs
*/
*/
protected
$_currentRoot
=
array
();
protected
$_currentRoot
=
array
();
/**
* Initializes VFS stream wrapper/
*/
public
function
__construct
()
{
Stream
::
setup
();
}
/**
/**
* Applies VFS directory structure
* Applies VFS directory structure
*
*
...
@@ -53,8 +45,10 @@ class EcomDev_PHPUnit_Model_Fixture_Vfs
...
@@ -53,8 +45,10 @@ class EcomDev_PHPUnit_Model_Fixture_Vfs
*/
*/
public
function
apply
(
$data
)
public
function
apply
(
$data
)
{
{
if
(
StreamWrapper
::
getRoot
())
{
$this
->
_currentRoot
[]
=
StreamWrapper
::
getRoot
();
$this
->
_currentRoot
[]
=
StreamWrapper
::
getRoot
();
Stream
::
create
(
$data
);
}
Stream
::
setup
(
'root'
,
null
,
$data
);
return
$this
;
return
$this
;
}
}
...
@@ -97,6 +91,10 @@ class EcomDev_PHPUnit_Model_Fixture_Vfs
...
@@ -97,6 +91,10 @@ class EcomDev_PHPUnit_Model_Fixture_Vfs
*/
*/
public
function
url
(
$path
)
public
function
url
(
$path
)
{
{
if
(
strpos
(
$path
,
StreamWrapper
::
getRoot
()
->
getName
())
===
false
)
{
$path
=
StreamWrapper
::
getRoot
()
->
getName
()
.
'/'
.
$path
;
}
return
Stream
::
url
(
$path
);
return
Stream
::
url
(
$path
);
}
}
}
}
app/code/community/EcomDev/PHPUnit/bootstrap.php
View file @
cdfc200a
...
@@ -7,7 +7,6 @@ if (version_compare(PHP_VERSION, '5.3', '<')) {
...
@@ -7,7 +7,6 @@ if (version_compare(PHP_VERSION, '5.3', '<')) {
$_baseDir
=
getcwd
();
$_baseDir
=
getcwd
();
// Include Mage file by detecting app root
// Include Mage file by detecting app root
require_once
$_baseDir
.
DIRECTORY_SEPARATOR
.
'app'
.
DIRECTORY_SEPARATOR
.
'Mage.php'
;
require_once
$_baseDir
.
DIRECTORY_SEPARATOR
.
'app'
.
DIRECTORY_SEPARATOR
.
'Mage.php'
;
...
@@ -29,13 +28,25 @@ if (!empty($_GET)) {
...
@@ -29,13 +28,25 @@ if (!empty($_GET)) {
Mage
::
app
(
'admin'
);
Mage
::
app
(
'admin'
);
Mage
::
getConfig
()
->
init
();
Mage
::
getConfig
()
->
init
();
// Removing Varien Autoload, to prevent errors with PHPUnit components
spl_autoload_unregister
(
array
(
\Varien_Autoload
::
instance
(),
'autoload'
));
spl_autoload_unregister
(
array
(
\Varien_Autoload
::
instance
(),
'autoload'
));
spl_autoload_register
(
function
(
$classname
)
{
// It is possible to include custom bootstrap file by specifying env variable shell
$classname
=
ltrim
(
$classname
,
"
\\
"
);
// or in server
preg_match
(
'/^(.+)?([^\\\\]+)$/U'
,
$classname
,
$match
);
if
(
isset
(
$_SERVER
[
'ECOMDEV_PHPUNIT_CUSTOM_BOOTSTRAP'
]))
{
$classname
=
str_replace
(
"
\\
"
,
"/"
,
$match
[
1
])
include
$_SERVER
[
'ECOMDEV_PHPUNIT_CUSTOM_BOOTSTRAP'
];
.
str_replace
(
array
(
"
\\
"
,
"_"
),
"/"
,
$match
[
2
])
}
.
".php"
;
@
include_once
$classname
;
if
(
!
defined
(
'ECOMDEV_PHPUNIT_NO_AUTOLOADER'
))
{
});
spl_autoload_register
(
function
(
$className
)
{
$filePath
=
strtr
(
ltrim
(
$className
,
'\\'
),
array
(
'\\'
=>
'/'
,
'_'
=>
'/'
)
);
@
include
$filePath
.
'.php'
;
});
}
lib/EcomDev/PHPUnit/Constraint/Config/Resource/Script.php
View file @
cdfc200a
...
@@ -140,7 +140,6 @@ class EcomDev_PHPUnit_Constraint_Config_Resource_Script
...
@@ -140,7 +140,6 @@ class EcomDev_PHPUnit_Constraint_Config_Resource_Script
)
)
);
);
if
(
!
is_dir
(
$directory
))
{
if
(
!
is_dir
(
$directory
))
{
return
$versions
;
return
$versions
;
}
}
...
...
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