From 3a974aab96dd301b37875a640580b6e916199578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20F=C3=BChr?= Date: Tue, 15 Dec 2015 15:45:18 +0100 Subject: [PATCH 01/19] Move /app/bootstrap.php and /app/autoload.php to /dev/tests/integration/framework/ and adapt include paths, because the /app/bootstrap.php conflicts with the magento core /app/bootstrap.php introduced in 1.14.2. --- .../tests/integration/framework/autoloadCore.php} | 3 +-- src/dev/tests/integration/framework/bootstrap.php | 2 +- .../tests/integration/framework/bootstrapCore.php} | 5 ++--- 3 files changed, 4 insertions(+), 6 deletions(-) rename src/{app/autoload.php => dev/tests/integration/framework/autoloadCore.php} (93%) rename src/{app/bootstrap.php => dev/tests/integration/framework/bootstrapCore.php} (94%) diff --git a/src/app/autoload.php b/src/dev/tests/integration/framework/autoloadCore.php similarity index 93% rename from src/app/autoload.php rename to src/dev/tests/integration/framework/autoloadCore.php index d88ccbc..3280c98 100644 --- a/src/app/autoload.php +++ b/src/dev/tests/integration/framework/autoloadCore.php @@ -1,5 +1,4 @@ */ -require_once __DIR__ . '/../lib/Magento/Autoload/IncludePath.php'; +require_once BP . '/lib/Magento/Autoload/IncludePath.php'; if (class_exists('Magento\\Autoload\\IncludePath', false)) { spl_autoload_register('Magento\\Autoload\\IncludePath::load', true, true); } else { diff --git a/src/dev/tests/integration/framework/bootstrap.php b/src/dev/tests/integration/framework/bootstrap.php index 367d950..ade3773 100644 --- a/src/dev/tests/integration/framework/bootstrap.php +++ b/src/dev/tests/integration/framework/bootstrap.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -require_once __DIR__ . '/../../../../app/bootstrap.php'; +require_once __DIR__ . '/bootstrapCore.php'; require_once __DIR__ . '/../../static/testsuite/Utility/Classes.php'; Utility_Files::init(new Utility_Files(realpath(__DIR__ . '/../../../..'))); diff --git a/src/app/bootstrap.php b/src/dev/tests/integration/framework/bootstrapCore.php similarity index 94% rename from src/app/bootstrap.php rename to src/dev/tests/integration/framework/bootstrapCore.php index 7dca0c7..389b2e6 100644 --- a/src/app/bootstrap.php +++ b/src/dev/tests/integration/framework/bootstrapCore.php @@ -1,5 +1,4 @@ Date: Mon, 13 Jun 2016 15:17:51 +0200 Subject: [PATCH 02/19] Implement contants for static proxy mocks (Mage) --- .../MagentoUnitTesting/Helper/Static/Mock.php | 41 ++++++++++++++++++- .../MagentoUnitTesting/MageProxy.php | 16 ++++++++ .../MagentoUnitTesting/TestCase/Abstract.php | 6 +++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/Helper/Static/Mock.php b/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/Helper/Static/Mock.php index 40e67d4..3670134 100644 --- a/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/Helper/Static/Mock.php +++ b/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/Helper/Static/Mock.php @@ -37,6 +37,11 @@ class TechDivision_MagentoUnitTesting_Helper_Static_Mock */ protected $_methods = array(); + /** + * @var array + */ + protected $_constants = array(); + /** * @param string $name */ @@ -61,6 +66,21 @@ public function method($name, $return, $type = self::TYPE_STATIC_PUBLIC) return $this; } + /** + * @param string $name + * @param string|int|float $value + * + * @return TechDivision_MagentoUnitTesting_Helper_Static_Mock + */ + public function addConstant($name, $value) + { + $this->_constants[$name] = array( + 'name' => $name, + 'value' => $value + ); + return $this; + } + /** * @throws TechDivision_MagentoUnitTesting_Exception_Helper_Static * @return TechDivision_MagentoUnitTesting_Helper_Static_Mock @@ -110,9 +130,10 @@ public function handleCallback($method, array $args = null) protected function _getCode() { $class = sprintf( - "class %s \n { \n\n %s \n\n %s \n\n }", + "class %s \n { \n\n %s \n\n %s \n\n %s \n\n }", $this->_className, $this->_getInceptionMethods(), + implode("\n\n", $this->_getConstantsCode()), implode("\n\n", $this->_getMethodsCode()) ); return $class; @@ -161,4 +182,22 @@ protected function _getInceptionMethods() return $interception; } + + /** + * @return string + */ + protected function _getConstantsCode() + { + $constants = array(); + + foreach ($this->_constants as $constantData) { + $constants[] = sprintf( + "const %s = '%s';", + $constantData['name'], + $constantData['value'] + ); + } + + return $constants; + } } \ No newline at end of file diff --git a/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/MageProxy.php b/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/MageProxy.php index b534942..85993c1 100644 --- a/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/MageProxy.php +++ b/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/MageProxy.php @@ -24,6 +24,14 @@ */ class TechDivision_MagentoUnitTesting_MageProxy { + /** + * Magento edition constants + */ + const EDITION_COMMUNITY = 'Community'; + const EDITION_ENTERPRISE = 'Enterprise'; + const EDITION_PROFESSIONAL = 'Professional'; + const EDITION_GO = 'Go'; + /** * @param string $key * @return Mage_Core_Model_Abstract @@ -33,6 +41,14 @@ public function getSingleton($key) return Mage::getSingleton($key); } + /** + * @return string + */ + public function getEdition() + { + return Mage::getEdition(); + } + /** * @param string $key * @return false|Mage_Core_Model_Abstract diff --git a/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/TestCase/Abstract.php b/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/TestCase/Abstract.php index fab68aa..1d5a3f2 100644 --- a/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/TestCase/Abstract.php +++ b/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/TestCase/Abstract.php @@ -177,6 +177,12 @@ protected function _initMageMock() ->method("setIsDeveloperMode", null) ->method("getIsDeveloperMode", null) ->method("setIsDownloader", null) + + ->addConstant('EDITION_COMMUNITY', 'Community') + ->addConstant('EDITION_ENTERPRISE', 'Enterprise') + ->addConstant('EDITION_PROFESSIONAL', 'Professional') + ->addConstant('EDITION_GO', 'Go') + ->init(); } Mage::__setCallbackInstance($this->getMageMock()); From e5e3442838919d6031fcab3de92f98d2cf390389 Mon Sep 17 00:00:00 2001 From: Harald Deiser Date: Mon, 13 Jun 2016 15:20:48 +0200 Subject: [PATCH 03/19] Remove unnecessary contants in MageProxy class --- .../TechDivision/MagentoUnitTesting/MageProxy.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/MageProxy.php b/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/MageProxy.php index 85993c1..6882991 100644 --- a/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/MageProxy.php +++ b/src/dev/tests/unit/framework/TechDivision/MagentoUnitTesting/MageProxy.php @@ -24,14 +24,6 @@ */ class TechDivision_MagentoUnitTesting_MageProxy { - /** - * Magento edition constants - */ - const EDITION_COMMUNITY = 'Community'; - const EDITION_ENTERPRISE = 'Enterprise'; - const EDITION_PROFESSIONAL = 'Professional'; - const EDITION_GO = 'Go'; - /** * @param string $key * @return Mage_Core_Model_Abstract From 1c92e7701755c5e1491600f438978a81bbf5679f Mon Sep 17 00:00:00 2001 From: Jean-Bernard Valentaten Date: Mon, 20 Jun 2016 17:59:19 +0200 Subject: [PATCH 04/19] [IMPROVEMENT] Added modman file to allow installation of module via composer --- modman | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 modman diff --git a/modman b/modman new file mode 100644 index 0000000..8609f02 --- /dev/null +++ b/modman @@ -0,0 +1,11 @@ +src/app/code/community/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Interface.php app/code/community/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Interface.php +src/app/code/community/Mage/Install/Model/Installer/Db/Mysql4.php app/code/community/Mage/Install/Model/Installer/Db/Mysql4.php +src/app/code/community/Mage/Install/Model/Installer/Console.php app/code/community/Mage/Install/Model/Installer/Console.php +src/app/code/community/TechDivision/MagentoUnitTesting app/code/community/TechDivision/MagentoUnitTesting +src/dev/tests/unit dev/tests/unit +src/dev/tests/integration dev/tests/integration +src/dev/tests/performance dev/tests/performance +src/dev/tests/static dev/tests/static +src/dev/tests/skeletonBootstrap.php dev/tests/skeletonBootstrap.php +src/dev/shell dev/shell +src/dev/tools dev/tools From 4a5eaa401f6bf71a6db542c3eb9953affca89f37 Mon Sep 17 00:00:00 2001 From: Jean-Bernard Valentaten Date: Tue, 21 Jun 2016 09:04:27 +0200 Subject: [PATCH 05/19] [IMPROVEMENT] Changed type in composer.json to 'magento-module' such that it autoinstalls when using magento-hackathon/magento-composer-installer --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 84ab76e..a109203 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "techdivision/techdivision_magentounittesting", - "type": "magento-extension", + "type": "magento-module", "description": "This projects aims to bring the core tests and the important parts of the Magento 2 testsuite to Magento 1.", "homepage": "https://github.com/techdivision/TechDivision_MagentoUnitTesting", "license": ["OSL-3.0"], @@ -17,4 +17,4 @@ "config" : { "vendor-dir" : "src/lib" } -} \ No newline at end of file +} From c3d4dffade2287c10d3a3fc1bb613ed9ebdc5099 Mon Sep 17 00:00:00 2001 From: Jean-Bernard Valentaten Date: Tue, 21 Jun 2016 09:19:03 +0200 Subject: [PATCH 06/19] [IMPROVEMENT] Added phpunit 3.7.* to composer requirements --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index a109203..b5803cf 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ ], "require": { "php" : ">=5.3.0", + "phpunit/phpunit": "3.7.*", "mikey179/vfsStream": "1.2.0" }, "config" : { From f78aea2ef4595dde2dabf8dee36352c6e648005b Mon Sep 17 00:00:00 2001 From: Jean-Bernard Valentaten Date: Tue, 21 Jun 2016 10:46:24 +0200 Subject: [PATCH 07/19] [FIX] Fixed that including of composer autoload would fail in composer/modman context --- src/dev/tests/unit/framework/bootstrap.php | 53 +++++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/src/dev/tests/unit/framework/bootstrap.php b/src/dev/tests/unit/framework/bootstrap.php index 59aad34..03fbb22 100755 --- a/src/dev/tests/unit/framework/bootstrap.php +++ b/src/dev/tests/unit/framework/bootstrap.php @@ -57,8 +57,16 @@ set_include_path(implode(PATH_SEPARATOR, $includePaths)); spl_autoload_register('magentoAutoloadForUnitTests', true, true); -// Include composer autoloader -include_once __DIR__ . '/../../../../lib/autoload.php'; +/* + * Include composer autoloader. + * + * Since every project can define the location of its vendor dir and thus of + * its autoload.php, we have to ask composer where its vendor dir is located. + * Our stategy is to seek upwards until we find a composer.json (the only + * actual constant in every setup) and then query composer from that directory. + */ +$vendorDir = getComposerVendorDir(); +include_once $vendorDir . DS . 'autoload.php'; register_shutdown_function('magentoCleanTmpForUnitTests'); @@ -99,3 +107,44 @@ function magentoCleanTmpForUnitTests() } } } + +/** + * Tries to find the root directory of a composer managed project. + * + * If the composer root cannot be found, returns null + * + * @return string|null + */ +function getComposerRoot() +{ + $composerRoot = realpath(__DIR__ . DS . '..'); + + while (!is_file($composerRoot . DS . 'composer.json')) { + $newRoot = realpath($composerRoot . DS . '..'); + + //if we can climb higher, we return null as we have reached fs root + if ($newRoot == $composerRoot) { + return null; + } + } + + return $composerRoot; +} + +/** + * Tries to query composer about its vendor dir. + * + * @return string|null + */ +function getComposerVendorDir() +{ + $composerRoot = getComposerRoot(); + $out = null; + + if ($composerRoot !== null) { + $out = shell_exec('composer config --absolute vendor-dir'); + $out = trim($out); + } + + return $out; +} From 023830aff9e7a0f84a905167257855663d929c2b Mon Sep 17 00:00:00 2001 From: Jean-Bernard Valentaten Date: Tue, 21 Jun 2016 10:54:47 +0200 Subject: [PATCH 08/19] [FIX] Fixed endless loop --- src/dev/tests/unit/framework/bootstrap.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dev/tests/unit/framework/bootstrap.php b/src/dev/tests/unit/framework/bootstrap.php index 03fbb22..90f641b 100755 --- a/src/dev/tests/unit/framework/bootstrap.php +++ b/src/dev/tests/unit/framework/bootstrap.php @@ -122,10 +122,11 @@ function getComposerRoot() while (!is_file($composerRoot . DS . 'composer.json')) { $newRoot = realpath($composerRoot . DS . '..'); - //if we can climb higher, we return null as we have reached fs root + //if we can't climb higher, we return null as we have reached fs root if ($newRoot == $composerRoot) { return null; } + $composerRoot = $newRoot; } return $composerRoot; From f0732eaea75540429bfd0c3197a530c09e908a0a Mon Sep 17 00:00:00 2001 From: Jean-Bernard Valentaten Date: Tue, 21 Jun 2016 11:32:22 +0200 Subject: [PATCH 09/19] [FIX] Fixed modman incompatibility due to relative include paths --- src/dev/tests/unit/framework/bootstrap.php | 73 +++++++++++++++++++--- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/src/dev/tests/unit/framework/bootstrap.php b/src/dev/tests/unit/framework/bootstrap.php index 90f641b..d4960c0 100755 --- a/src/dev/tests/unit/framework/bootstrap.php +++ b/src/dev/tests/unit/framework/bootstrap.php @@ -24,6 +24,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +/* + * Main + */ ini_set('error_reporting', E_ALL & ~E_NOTICE | E_STRICT); define('TESTS_TEMP_DIR', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'tmp'); @@ -43,14 +46,15 @@ throw new Exception(TESTS_TEMP_DIR . ' must be writable.'); } -$includePaths = array( - __DIR__ . "/", +$baseIncludePath = getCanonicalPath(__DIR__ . '/../../../..'); +$includePaths = array( + __DIR__ . '/', __DIR__ . '/../testsuite', - __DIR__ . '/../../../../lib', - __DIR__ . '/../../../../app/code/local', - __DIR__ . '/../../../../app/code/community', - __DIR__ . '/../../../../app/code/core', - __DIR__ . '/../../../../app/', + __DIR__ . $baseIncludePath . '/lib', + __DIR__ . $baseIncludePath . '/app/code/local', + __DIR__ . $baseIncludePath . '/app/code/community', + __DIR__ . $baseIncludePath . '/app/code/core', + __DIR__ . $baseIncludePath . '/app/', get_include_path() ); @@ -74,6 +78,16 @@ include_once "Mage/Core/functions.php"; +/* + * Callbacks + */ + +/** + * Callback for SPL autoloader + * + * @param string $class The fully qualified name of the class that shall be loaded + * @return bool Whether the class could be loaded + */ function magentoAutoloadForUnitTests($class) { $file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; @@ -90,6 +104,11 @@ function magentoAutoloadForUnitTests($class) return false; } +/** + * Callback for php shutdown. + * + * Removes all temporary files from temp folder. + */ function magentoCleanTmpForUnitTests() { $files = new RecursiveIteratorIterator( @@ -108,6 +127,46 @@ function magentoCleanTmpForUnitTests() } } +/* + * Functions + */ + +/** + * Returns the canonical path for $path. + * + * Instead of using PHPs relative path resolving mechanism which would return + * the realpath and thus not be compliant with modmans symlink deployment, we + * implement an algorithm that returns a canonical path no matter whether it + * includes symlinks. + * + * @param string $path + * @return string + */ +function getCanonicalPath($path) +{ + $parts = explode(DS, $path); + $canonicalPath = array_shift($parts); //we assume that the very first part is absolute + + foreach ($parts as $part) { + switch ($part) { + case '.': + //identity, no change required + break; + case '..': + //parent, strip last part from path + $canonicalPath = dirname($canonicalPath); + break; + default: + //simply append to path + $canonicalPath .= DS . $part; + } + } + + return $canonicalPath; + + return $canonicalPath; +} + /** * Tries to find the root directory of a composer managed project. * From ecaed6f7b290f898c4a91485812524cdec581c6f Mon Sep 17 00:00:00 2001 From: Jean-Bernard Valentaten Date: Tue, 21 Jun 2016 11:46:49 +0200 Subject: [PATCH 10/19] [FIX] Added missing lib files to modman --- modman | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modman b/modman index 8609f02..db71c28 100644 --- a/modman +++ b/modman @@ -9,3 +9,18 @@ src/dev/tests/static dev/tests/static src/dev/tests/skeletonBootstrap.php dev/tests/skeletonBootstrap.php src/dev/shell dev/shell src/dev/tools dev/tools +src/lib/Magento/Autoload/ClassMap.php lib/Magento/Autoload/ClassMap.php +src/lib/Magento/Autoload/IncludePath.php lib/Magento/Autoload/IncludePath.php +src/lib/Magento/Autoload.php lib/Magento/Autoload.php +src/lib/Magento/Config/Dom.php lib/Magento/Config/Dom.php +src/lib/Magento/Config/Theme.php lib/Magento/Config/Theme.php +src/lib/Magento/Config/theme.xsd lib/Magento/Config/theme.xsd +src/lib/Magento/Config/View.php lib/Magento/Config/View.php +src/lib/Magento/Config/view.xsd lib/Magento/Config/view.xsd +src/lib/Magento/Config/XmlAbstract.php lib/Magento/Config/XmlAbstract.php +src/lib/Magento/Convert/Excel.php lib/Magento/Convert/Excel.php +src/lib/Magento/Data/Structure.php lib/Magento/Data/Structure.php +src/lib/Magento/Exception.php lib/Magento/Exception.php +src/lib/Magento/Profiler.php lib/Magento/Profiler.php +src/lib/Magento/Test/Listener/Annotation/Rewrite.php lib/Magento/Test/Listener/Annotation/Rewrite.php +src/lib/Magento/Test/Listener.php lib/Magento/Test/Listener.php From d049d97f06ee0075640a4fbab1d84ee3cac07556 Mon Sep 17 00:00:00 2001 From: Jean-Bernard Valentaten Date: Tue, 21 Jun 2016 12:22:01 +0200 Subject: [PATCH 11/19] [FIX] Fixed include paths --- src/dev/tests/unit/framework/bootstrap.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/dev/tests/unit/framework/bootstrap.php b/src/dev/tests/unit/framework/bootstrap.php index d4960c0..fd7dd19 100755 --- a/src/dev/tests/unit/framework/bootstrap.php +++ b/src/dev/tests/unit/framework/bootstrap.php @@ -50,11 +50,11 @@ $includePaths = array( __DIR__ . '/', __DIR__ . '/../testsuite', - __DIR__ . $baseIncludePath . '/lib', - __DIR__ . $baseIncludePath . '/app/code/local', - __DIR__ . $baseIncludePath . '/app/code/community', - __DIR__ . $baseIncludePath . '/app/code/core', - __DIR__ . $baseIncludePath . '/app/', + $baseIncludePath . '/lib', + $baseIncludePath . '/app/code/local', + $baseIncludePath . '/app/code/community', + $baseIncludePath . '/app/code/core', + $baseIncludePath . '/app/', get_include_path() ); @@ -163,8 +163,6 @@ function getCanonicalPath($path) } return $canonicalPath; - - return $canonicalPath; } /** From dcca2816f2d02a3cbe0c8db57fc0994ec7424766 Mon Sep 17 00:00:00 2001 From: Jean-Bernard Valentaten Date: Tue, 21 Jun 2016 12:42:32 +0200 Subject: [PATCH 12/19] [FIX] Fixed include path problems --- src/dev/tests/unit/framework/bootstrap.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/dev/tests/unit/framework/bootstrap.php b/src/dev/tests/unit/framework/bootstrap.php index fd7dd19..7e5c31b 100755 --- a/src/dev/tests/unit/framework/bootstrap.php +++ b/src/dev/tests/unit/framework/bootstrap.php @@ -46,7 +46,7 @@ throw new Exception(TESTS_TEMP_DIR . ' must be writable.'); } -$baseIncludePath = getCanonicalPath(__DIR__ . '/../../../..'); +$baseIncludePath = getBaseIncludePath(); $includePaths = array( __DIR__ . '/', __DIR__ . '/../testsuite', @@ -131,6 +131,25 @@ function magentoCleanTmpForUnitTests() * Functions */ +/** + * Tries to guess the base path for includes such that files are included from magento root. + * + * @return string + */ +function getBaseIncludePath() +{ + $baseIncludePath = __DIR__ . '/../../../..'; + $composerRoot = getComposerRoot(); + $content = file_get_contents($composerRoot . DS . 'composer.json'); + $data = json_decode($content, true); + + if (isset($data['extra']['magento-root-dir'])) { + $baseIncludePath = $composerRoot . $data['extra']['magento-root-dir']; + } + + return getCanonicalPath($baseIncludePath); +} + /** * Returns the canonical path for $path. * From 551b8a51e0de8035be8778b123801f12eb6b6a09 Mon Sep 17 00:00:00 2001 From: Jean-Bernard Valentaten Date: Tue, 21 Jun 2016 13:16:57 +0200 Subject: [PATCH 13/19] [FIX] Fixed issue with base include path --- src/dev/tests/unit/framework/bootstrap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dev/tests/unit/framework/bootstrap.php b/src/dev/tests/unit/framework/bootstrap.php index 7e5c31b..b6ce8f1 100755 --- a/src/dev/tests/unit/framework/bootstrap.php +++ b/src/dev/tests/unit/framework/bootstrap.php @@ -144,7 +144,7 @@ function getBaseIncludePath() $data = json_decode($content, true); if (isset($data['extra']['magento-root-dir'])) { - $baseIncludePath = $composerRoot . $data['extra']['magento-root-dir']; + $baseIncludePath = $composerRoot . DS . $data['extra']['magento-root-dir']; } return getCanonicalPath($baseIncludePath); @@ -193,7 +193,7 @@ function getCanonicalPath($path) */ function getComposerRoot() { - $composerRoot = realpath(__DIR__ . DS . '..'); + $composerRoot = realpath(__DIR__ . DS . '../../../../../..'); while (!is_file($composerRoot . DS . 'composer.json')) { $newRoot = realpath($composerRoot . DS . '..'); From 1cc8ceb1cb1b27f6be7d85e1168e61ea23921017 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Wed, 22 Jun 2016 11:36:19 +0200 Subject: [PATCH 14/19] Update version number to 1.1.0 --- build.default.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.default.properties b/build.default.properties index 20dc45c..b683ba8 100644 --- a/build.default.properties +++ b/build.default.properties @@ -27,7 +27,7 @@ magento.edition = enterprise magento.version = 1.13.1.0 # ---- Module Release Settings -------------------------------------------------- -release.version.number = 1.0.0 +release.version.number = 1.1.0 release.version = ${release.version.number}- release.stability = stable From 941bfdec0b7075875578f6ddd933b4118461891e Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Wed, 22 Jun 2016 15:53:59 +0200 Subject: [PATCH 15/19] Add some changes for better backwards compatibility --- composer.json | 2 +- composer.lock | 438 ++++++++++++++++++++- src/dev/tests/unit/framework/bootstrap.php | 13 +- src/dev/tests/unit/phpunit.xml.dist | 4 - 4 files changed, 435 insertions(+), 22 deletions(-) diff --git a/composer.json b/composer.json index b5803cf..ad9252d 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "require": { "php" : ">=5.3.0", - "phpunit/phpunit": "3.7.*", + "phpunit/phpunit": "3.7.37", "mikey179/vfsStream": "1.2.0" }, "config" : { diff --git a/composer.lock b/composer.lock index c1d780b..f9c3130 100644 --- a/composer.lock +++ b/composer.lock @@ -1,9 +1,11 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" ], - "hash": "18eb7c52daaf25314253180b4a3e483a", + "hash": "a91e32787f5fc7ef0eee814b269e2a3b", + "content-hash": "73eb4728f54ccbb7d6b0a33ad9f354f6", "packages": [ { "name": "mikey179/vfsStream", @@ -34,22 +36,430 @@ ], "homepage": "http://vfs.bovigo.org/", "time": "2013-04-01 10:41:02" + }, + { + "name": "phpunit/php-code-coverage", + "version": "1.2.18", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", + "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": ">=1.3.0@stable", + "phpunit/php-text-template": ">=1.2.0@stable", + "phpunit/php-token-stream": ">=1.1.3,<1.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*@dev" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.0.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2014-09-02 10:13:14" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2015-06-21 13:08:43" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2016-05-12 18:03:57" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ad4e1e23ae01b483c16f600ff1bebec184588e32", + "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2014-03-03 05:10:30" + }, + { + "name": "phpunit/phpunit", + "version": "3.7.37", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "ae6cefd7cc84586a5ef27e04bae11ee940ec63dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ae6cefd7cc84586a5ef27e04bae11ee940ec63dc", + "reference": "ae6cefd7cc84586a5ef27e04bae11ee940ec63dc", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpunit/php-code-coverage": "~1.2", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.1", + "phpunit/php-timer": "~1.0", + "phpunit/phpunit-mock-objects": "~1.2", + "symfony/yaml": "~2.0" + }, + "require-dev": { + "pear-pear.php.net/pear": "1.9.4" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "composer/bin/phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "", + "../../symfony/yaml/" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "http://www.phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2014-04-30 12:24:19" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-text-template": ">=1.1.1@stable" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2013-01-13 10:24:48" + }, + { + "name": "symfony/yaml", + "version": "v2.8.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/815fabf3f48c7d1df345a69d1ad1a88f59757b34", + "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2016-06-06 11:11:27" } ], - "packages-dev": [ - - ], - "aliases": [ - - ], + "packages-dev": [], + "aliases": [], "minimum-stability": "stable", - "stability-flags": [ - - ], + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, "platform": { "php": ">=5.3.0" }, - "platform-dev": [ - - ] + "platform-dev": [] } diff --git a/src/dev/tests/unit/framework/bootstrap.php b/src/dev/tests/unit/framework/bootstrap.php index b6ce8f1..a902bd7 100755 --- a/src/dev/tests/unit/framework/bootstrap.php +++ b/src/dev/tests/unit/framework/bootstrap.php @@ -138,9 +138,16 @@ function magentoCleanTmpForUnitTests() */ function getBaseIncludePath() { - $baseIncludePath = __DIR__ . '/../../../..'; + + $baseIncludePath = implode(DS, array(__DIR__, '..', '..', '..', '..')); $composerRoot = getComposerRoot(); - $content = file_get_contents($composerRoot . DS . 'composer.json'); + $composerJsonFile = $composerRoot . DS . 'composer.json'; + + if (!is_file($composerJsonFile)) { + return $baseIncludePath; + } + + $content = file_get_contents($composerJsonFile); $data = json_decode($content, true); if (isset($data['extra']['magento-root-dir'])) { @@ -216,7 +223,7 @@ function getComposerRoot() function getComposerVendorDir() { $composerRoot = getComposerRoot(); - $out = null; + $out = implode(DS, array(__DIR__, '..', '..', '..', '..', 'lib')); if ($composerRoot !== null) { $out = shell_exec('composer config --absolute vendor-dir'); diff --git a/src/dev/tests/unit/phpunit.xml.dist b/src/dev/tests/unit/phpunit.xml.dist index c585bfb..67fff88 100755 --- a/src/dev/tests/unit/phpunit.xml.dist +++ b/src/dev/tests/unit/phpunit.xml.dist @@ -50,9 +50,5 @@ - - - - From a3a0a3696c79fa2baab2ee7e9502d7383e0b72f8 Mon Sep 17 00:00:00 2001 From: Jean-Bernard Valentaten Date: Thu, 23 Jun 2016 11:38:05 +0200 Subject: [PATCH 16/19] [FIX] Fixed issue that when using this module, installation could fail on newer mysql versions --- .../code/community/Mage/Install/Model/Installer/Db/Mysql4.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/code/community/Mage/Install/Model/Installer/Db/Mysql4.php b/src/app/code/community/Mage/Install/Model/Installer/Db/Mysql4.php index 963660f..1fd1f49 100644 --- a/src/app/code/community/Mage/Install/Model/Installer/Db/Mysql4.php +++ b/src/app/code/community/Mage/Install/Model/Installer/Db/Mysql4.php @@ -43,8 +43,8 @@ public function getVersion() public function supportEngine() { $variables = $this->_getConnection() - ->fetchPairs('SHOW VARIABLES'); - return (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') ? false : true; + ->fetchPairs('SHOW ENGINES'); + return isset($variables['InnoDB']) && ($variables['InnoDB'] == 'DEFAULT' || $variables['InnoDB'] == 'YES'); } /** From c817411662c76fd1ccc42e29dc208b61c1c01ebb Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Mon, 1 Aug 2016 17:37:02 +0200 Subject: [PATCH 17/19] Fix package suffix for Pear --- build.default.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.default.properties b/build.default.properties index b683ba8..23f6d29 100644 --- a/build.default.properties +++ b/build.default.properties @@ -28,8 +28,8 @@ magento.version = 1.13.1.0 # ---- Module Release Settings -------------------------------------------------- release.version.number = 1.1.0 -release.version = ${release.version.number}- release.stability = stable +release.version = ${release.version.number}${release.stability} # ---- Module Api Settings ------------------------------------------------------ api.version = ${release.version.number}${release.stability} From ab346be66569e5b6af08e73715eee0a186e6e2b4 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Tue, 2 Aug 2016 12:11:12 +0200 Subject: [PATCH 18/19] Add method_existis for isReplaced method call --- src/lib/Magento/Test/Listener.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/Magento/Test/Listener.php b/src/lib/Magento/Test/Listener.php index fb3e0ea..47bff38 100644 --- a/src/lib/Magento/Test/Listener.php +++ b/src/lib/Magento/Test/Listener.php @@ -105,7 +105,11 @@ protected function _notifyObservers($eventName, $reverseOrder = false) $observers = ($reverseOrder ? array_reverse($this->_observers) : $this->_observers); foreach ($observers as $observerInstance) { // TD Start - if($eventName == 'startTest' && $this->_currentTest->isReplaced()) { + if( + $eventName == 'startTest' + && method_exists($this->_currentTest, "isReplaced") + && $this->_currentTest->isReplaced() + ) { break; } // TD End From 1d0061b214dd69698a31751b713437c79b4aad62 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Tue, 2 Aug 2016 12:12:11 +0200 Subject: [PATCH 19/19] Update release version --- build.default.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.default.properties b/build.default.properties index 23f6d29..c814ce9 100644 --- a/build.default.properties +++ b/build.default.properties @@ -27,7 +27,7 @@ magento.edition = enterprise magento.version = 1.13.1.0 # ---- Module Release Settings -------------------------------------------------- -release.version.number = 1.1.0 +release.version.number = 1.1.1 release.stability = stable release.version = ${release.version.number}${release.stability}