-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from snowio/integration-tests-fixes
Add integration test setup
- Loading branch information
Showing
5 changed files
with
124 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
language: php | ||
php: | ||
- 7.3 | ||
- 7.4 | ||
dist: xenial | ||
|
||
env: | ||
matrix: | ||
- TEST_GROUP=magento_latest | ||
# - TEST_GROUP=magento_23 | ||
matrix: | ||
exclude: | ||
- php: 7.4 | ||
env: TEST_GROUP=magento_23 | ||
- php: 7.3 | ||
env: TEST_GROUP=magento_latest | ||
|
||
before_install: | ||
- phpenv config-rm xdebug.ini || true | ||
- composer self-update --1 | ||
|
||
install: | ||
- export COMPOSER_MEMORY_LIMIT=-1 | ||
- export COMPOSER_PACKAGE_NAME=$(composer config name) | ||
- composer install --no-interaction | ||
# Install magento | ||
- if [[ $TEST_GROUP = magento_23 ]]; then NAME=snowmodule FULL_INSTALL=0 VERSION=2.3.6-p1 . ./vendor/bin/travis-install-magento.sh; fi | ||
- if [[ $TEST_GROUP = magento_latest ]]; then NAME=snowmodule FULL_INSTALL=0 . ./vendor/bin/travis-install-magento.sh; fi | ||
# Install this module | ||
- cd vendor/ampersand/travis-vanilla-magento/instances/snowmodule | ||
- export COMPOSER_MEMORY_LIMIT=-1 | ||
- composer config repo.snowmodule git "$TRAVIS_BUILD_DIR" | ||
- composer require -vvv $COMPOSER_PACKAGE_NAME:"dev-$TRAVIS_BRANCH" || composer require -vvv $COMPOSER_PACKAGE_NAME:"$TRAVIS_BRANCH" | ||
# Configure for integration tests | ||
- mysql -uroot -e 'SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; DROP DATABASE IF EXISTS magento_integration_tests; CREATE DATABASE magento_integration_tests;' | ||
- cp dev/tests/integration/etc/install-config-mysql.travis-no-rabbitmq.php.dist dev/tests/integration/etc/install-config-mysql.php | ||
- php $TRAVIS_BUILD_DIR/travis/prepare_phpunit_config.php | ||
|
||
script: | ||
- vendor/bin/phpunit -c $(pwd)/dev/tests/integration/phpunit.xml.dist --testsuite Integration | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- postfix | ||
- apache2 | ||
- libapache2-mod-fastcgi | ||
|
||
services: | ||
- mysql | ||
|
||
cache: | ||
apt: true | ||
directories: | ||
- $HOME/.composer/cache | ||
- $HOME/bin | ||
|
||
after_failure: | ||
- test -d ./vendor/ampersand/travis-vanilla-magento/instances/snowmodule/var/report/ && for r in ./vendor/ampersand/travis-vanilla-magento/instances/snowmodule/var/report/*; do cat $r; done | ||
- test -f ./vendor/ampersand/travis-vanilla-magento/instances/snowmodule/var/log/system.log && grep -v "Broken reference" ./vendor/ampersand/travis-vanilla-magento/instances/snowmodule/var/log/system.log | ||
- test -f ./vendor/ampersand/travis-vanilla-magento/instances/snowmodule/var/log/exception.log && cat ./vendor/ampersand/travis-vanilla-magento/instances/snowmodule/var/log/exception.log | ||
- test -f ./vendor/ampersand/travis-vanilla-magento/instances/snowmodule/var/log/support_report.log && grep -v "Broken reference" ./vendor/ampersand/travis-vanilla-magento/instances/snowmodule/var/log/support_report.log | ||
- sleep 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
set_error_handler(function ($severity, $message, $file, $line) { | ||
throw new \ErrorException($message, $severity, $severity, $file, $line); | ||
}); | ||
|
||
$magentoPath = getcwd(); | ||
echo "Current working directory" . $magentoPath . PHP_EOL; | ||
if (isset($argv[1])) { | ||
$suggestedPath = realpath($argv[1]); | ||
if ($suggestedPath) { | ||
$magentoPath = $suggestedPath; | ||
} | ||
} | ||
|
||
if (!is_file($magentoPath . '/app/etc/di.xml')) { | ||
throw new \Exception('Could not detect magento root: ' . $magentoPath); | ||
} | ||
|
||
$configPath = "$magentoPath/dev/tests/integration/phpunit.xml.dist"; | ||
$travisBuildDir = getenv('TRAVIS_BUILD_DIR'); | ||
echo "Travis build dir is $travisBuildDir" . PHP_EOL; | ||
$packageName = \exec("composer config name -d $travisBuildDir", $output, $returnVal); | ||
if ($returnVal!=0) { | ||
var_dump($output); | ||
throw new \Exception("Could not get composer config name for $travisBuildDir"); | ||
} | ||
|
||
$config = new \SimpleXMLElement($configPath, 0, true); | ||
|
||
unset($config->testsuites); | ||
$testsuiteNode = $config->addChild('testsuites')->addChild('testsuite'); | ||
$testsuiteNode->addAttribute('name', 'Integration'); | ||
$testsuiteNode->addChild('directory', "$travisBuildDir/Test/Integration")->addAttribute('suffix', 'Test.php'); | ||
|
||
$config->asXML($configPath); |