From 3cdbb9a5c725e50ca5de51c546e9165be1199f45 Mon Sep 17 00:00:00 2001 From: Vlad Veselov Date: Sun, 7 Dec 2014 03:42:07 -0500 Subject: [PATCH 1/2] Adjust Travis CI builds configuration: fix integration tests by MySQL 5.6 pre-install, add PHP 5.6 variation, remove unused phpcs installation via PEAR --- .travis.yml | 32 +++++++++++++++++++++++++------- composer.json | 2 +- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 96feeb1024811..eccab7bf13201 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: php php: - 5.4 - 5.5 + - 5.6 env: - TEST_SUITE=unit - TEST_SUITE=integration @@ -10,6 +11,10 @@ env: - TEST_SUITE=static_annotation matrix: exclude: + - php: 5.4 + env: TEST_SUITE=static_phpcs + - php: 5.4 + env: TEST_SUITE=static_annotation - php: 5.5 env: TEST_SUITE=static_phpcs - php: 5.5 @@ -18,18 +23,31 @@ before_install: - sudo apt-get update -qq - sudo apt-get install -y -qq postfix before_script: - # mock mail + # Mock mail - sudo service postfix stop - smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 & - echo -e '#!/usr/bin/env bash\nexit 0' | sudo tee /usr/sbin/sendmail - - echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' | sudo tee "/home/travis/.phpenv/versions/`php -i | grep "PHP Version" | head -n 1 | grep -o -P '\d+\.\d+\.\d+.*'`/etc/conf.d/sendmail.ini" + - > + echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' + | sudo tee "/home/travis/.phpenv/versions/`php -i + | grep "PHP Version" + | head -n 1 + | grep -o -P '\d+\.\d+\.\d+.*'`/etc/conf.d/sendmail.ini" # Disable xDebug - echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini - # Create DB for Integration tests - - sh -c "if [ '$TEST_SUITE' = 'integration' ] || [ '$TEST_SUITE' = 'integration_integrity' ]; then mysql -e 'create database magento_integration_tests;'; mv dev/tests/integration/etc/install-config-mysql.travis.php.dist dev/tests/integration/etc/install-config-mysql.php; fi" - # Install tools for static tests - - sh -c "if [ '$TEST_SUITE' = 'static_phpcs' ] || [ '$TEST_SUITE' = 'static_annotation' ]; then pear install pear/PHP_CodeSniffer-1.5.2; fi" - # Change memmory_limit for travis server + # Install MySQL 5.6, create DB for integration tests + - > + sh -c "if [ '$TEST_SUITE' = 'integration' ] || [ '$TEST_SUITE' = 'integration_integrity' ]; then + sudo apt-get remove --purge mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5; + sudo apt-get autoremove; + sudo apt-get autoclean; + sudo apt-add-repository ppa:ondrej/mysql-5.6 -y; + sudo apt-get update; + sudo apt-get install mysql-server-5.6 mysql-client-5.6; + mysql -uroot -e 'SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; CREATE DATABASE magento_integration_tests;'; + mv dev/tests/integration/etc/install-config-mysql.travis.php.dist dev/tests/integration/etc/install-config-mysql.php; + fi" + # Change memory_limit for travis - echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - phpenv rehash; - composer install --no-interaction --prefer-source --dev diff --git a/composer.json b/composer.json index f3b581c30193c..ff365b635cf66 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "project", "version": "0.1.0-alpha107", "require": { - "php": "~5.4.11|~5.5.0", + "php": "~5.4.11|~5.5.0|~5.6.0", "zendframework/zend-stdlib": "2.3.1", "zendframework/zend-code": "2.3.1", "zendframework/zend-server": "2.3.1", From ddb82b0f8b441ab1daa992db7ed7a10c4d0ac216 Mon Sep 17 00:00:00 2001 From: Vlad Veselov Date: Sat, 13 Dec 2014 22:45:25 -0500 Subject: [PATCH 2/2] Additional Travis CI builds fixes: fix mistake in .travis.yml which broke everything, fix trouble caused integration tests failures on PHP 5.5/5.6, speed up composer install by bot preferring source, eliminate notice due to empty config value passed to @magentoConfigFixture --- .travis.yml | 3 +-- app/code/Magento/Directory/Helper/Data.php | 4 +++- .../Magento/TestFramework/Annotation/ConfigFixture.php | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 45287b64e5c76..dd261eb756799 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,8 +50,7 @@ before_script: # Change memory_limit for travis - echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - phpenv rehash; - - composer install --no-interaction --prefer-source --dev - - cd .. + - composer install --no-interaction --dev script: # Unit tests - sh -c "if [ '$TEST_SUITE' = 'unit' ]; then ./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist; fi" diff --git a/app/code/Magento/Directory/Helper/Data.php b/app/code/Magento/Directory/Helper/Data.php index c584342db5c8d..17d96968a6e92 100644 --- a/app/code/Magento/Directory/Helper/Data.php +++ b/app/code/Magento/Directory/Helper/Data.php @@ -182,7 +182,9 @@ public function getRegionJson() ]; } $json = $this->_coreHelper->jsonEncode($regions); - + if ($json === false) { + $json = 'false'; + } $this->_configCacheType->save($json, $cacheKey); } $this->_regionJson = $json; diff --git a/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php b/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php index d1cf52c0ad8b6..f5bb55aa9639f 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php @@ -102,7 +102,8 @@ protected function _assignConfigData(\PHPUnit_Framework_TestCase $test) if (preg_match('/^.+?(?=_store\s)/', $configPathAndValue, $matches)) { /* Store-scoped config value */ $storeCode = $matches[0] != 'current' ? $matches[0] : null; - list(, $configPath, $requiredValue) = preg_split('/\s+/', $configPathAndValue, 3); + $parts = preg_split('/\s+/', $configPathAndValue, 3); + list(, $configPath, $requiredValue) = $parts + ['', '', '']; $originalValue = $this->_getConfigValue($configPath, $storeCode); $this->_storeConfigValues[$storeCode][$configPath] = $originalValue; $this->_setConfigValue($configPath, $requiredValue, $storeCode);