File tree Expand file tree Collapse file tree
lib/EcomDev/PHPUnit/Constraint/Config/Resource Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "require" : {
3- "ecomdev/mage-ci" : " *"
3+ "ecomdev/mage-ci" : " *" ,
4+ "mikey179/vfsStream" : " *"
45 },
56 "config" : {
67 "bin-dir" : " bin"
Original file line number Diff line number Diff line change @@ -737,7 +737,8 @@ public function getVfs()
737737 return $ this ->_vfs ;
738738 }
739739
740- if (is_dir (Mage::getBaseDir ('lib ' ) . DS . 'vfsStream ' . DS . 'src ' )) {
740+ if (!class_exists ('\org\bovigo\vfs\vfsStream ' )
741+ && is_dir (Mage::getBaseDir ('lib ' ) . DS . 'vfsStream ' . DS . 'src ' )) {
741742 spl_autoload_register (array ($ this , 'vfsAutoload ' ), true , true );
742743 }
743744
Original file line number Diff line number Diff line change @@ -35,14 +35,6 @@ class EcomDev_PHPUnit_Model_Fixture_Vfs
3535 */
3636 protected $ _currentRoot = array ();
3737
38- /**
39- * Initializes VFS stream wrapper/
40- */
41- public function __construct ()
42- {
43- Stream::setup ();
44- }
45-
4638 /**
4739 * Applies VFS directory structure
4840 *
@@ -53,8 +45,10 @@ public function __construct()
5345 */
5446 public function apply ($ data )
5547 {
56- $ this ->_currentRoot [] = StreamWrapper::getRoot ();
57- Stream::create ($ data );
48+ if (StreamWrapper::getRoot ()) {
49+ $ this ->_currentRoot [] = StreamWrapper::getRoot ();
50+ }
51+ Stream::setup ('root ' , null , $ data );
5852 return $ this ;
5953 }
6054
@@ -97,6 +91,10 @@ public function dump()
9791 */
9892 public function url ($ path )
9993 {
94+ if (strpos ($ path , StreamWrapper::getRoot ()->getName ()) === false ) {
95+ $ path = StreamWrapper::getRoot ()->getName () . '/ ' . $ path ;
96+ }
97+
10098 return Stream::url ($ path );
10199 }
102100}
Original file line number Diff line number Diff line change 77
88$ _baseDir = getcwd ();
99
10-
1110// Include Mage file by detecting app root
1211require_once $ _baseDir . DIRECTORY_SEPARATOR . 'app ' . DIRECTORY_SEPARATOR . 'Mage.php ' ;
1312
2928Mage::app ('admin ' );
3029Mage::getConfig ()->init ();
3130
31+ // Removing Varien Autoload, to prevent errors with PHPUnit components
3232spl_autoload_unregister (array (\Varien_Autoload::instance (), 'autoload ' ));
3333
34- spl_autoload_register (function ($ classname ) {
35- $ classname = ltrim ($ classname , "\\" );
36- preg_match ('/^(.+)?([^ \\\\]+)$/U ' , $ classname , $ match );
37- $ classname = str_replace ("\\" , "/ " , $ match [1 ])
38- . str_replace (array ("\\" , "_ " ), "/ " , $ match [2 ])
39- . ".php " ;
40- @include_once $ classname ;
41- });
34+ // It is possible to include custom bootstrap file by specifying env variable shell
35+ // or in server
36+ if (isset ($ _SERVER ['ECOMDEV_PHPUNIT_CUSTOM_BOOTSTRAP ' ])) {
37+ include $ _SERVER ['ECOMDEV_PHPUNIT_CUSTOM_BOOTSTRAP ' ];
38+ }
39+
40+ if (!defined ('ECOMDEV_PHPUNIT_NO_AUTOLOADER ' )) {
41+ spl_autoload_register (function ($ className ) {
42+ $ filePath = strtr (
43+ ltrim ($ className , '\\' ),
44+ array (
45+ '\\' => '/ ' ,
46+ '_ ' => '/ '
47+ )
48+ );
49+
50+ @include $ filePath . '.php ' ;
51+ });
52+ }
Original file line number Diff line number Diff line change @@ -140,7 +140,6 @@ protected function parseVersions($directory)
140140 )
141141 );
142142
143-
144143 if (!is_dir ($ directory )) {
145144 return $ versions ;
146145 }
You can’t perform that action at this time.
0 commit comments