-
Notifications
You must be signed in to change notification settings - Fork 63
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 #103 from AmpersandHQ/add-refund-quantity-tests
Refactor testing structure and setup
- Loading branch information
Showing
7 changed files
with
69 additions
and
89 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,4 @@ | ||
### Checklist | ||
- [ ] Pull request has a meaningful description of its purpose, include affected Magento versions if it is a bug. | ||
- [ ] All commits are accompanied by meaningful commit messages | ||
- [ ] Tests have been ran / updated (see `./dev/README.md` for how to run tests) |
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 |
---|---|---|
@@ -1,89 +1,46 @@ | ||
language: php | ||
php: | ||
- 7.4 | ||
- 8.1 | ||
git: | ||
depth: false | ||
dist: xenial | ||
php: 8.1 | ||
|
||
env: | ||
- TEST_GROUP=magento_latest | ||
- TEST_GROUP=magento_242 | ||
- TEST_GROUP=magento_23 | ||
jobs: | ||
exclude: | ||
- php: 8.1 | ||
env: TEST_GROUP=magento_23 | ||
- php: 8.1 | ||
env: TEST_GROUP=magento_242 | ||
- php: 7.4 | ||
env: TEST_GROUP=magento_latest | ||
- TEST_GROUP=2-3-7 | ||
- TEST_GROUP=2-4-0 | ||
- TEST_GROUP=2-4-1 | ||
- TEST_GROUP=2-4-2 | ||
- TEST_GROUP=2-4-3 | ||
- TEST_GROUP=2-4-4 | ||
- TEST_GROUP=2-4-5 | ||
- TEST_GROUP=2-4-6 | ||
|
||
#jobs: | ||
# allow_failures: | ||
# - env: TEST_GROUP=2-4-3 | ||
# - env: TEST_GROUP=2-4-4 | ||
# - env: TEST_GROUP=2-4-5 | ||
# - env: TEST_GROUP=2-4-6 | ||
|
||
before_install: | ||
- travis_retry wget https://github.com/docker/compose/releases/download/v2.17.0/docker-compose-linux-x86_64 | ||
- sudo mv docker-compose-linux-x86_64 /usr/libexec/docker/cli-plugins/docker-compose | ||
- sudo chmod +x /usr/libexec/docker/cli-plugins/docker-compose | ||
- docker --version && docker compose version | ||
|
||
install: | ||
# Composer install | ||
- composer install --no-interaction | ||
# Do a quick code style check | ||
- PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --dry-run --rules=@PSR2 --diff src/ | ||
# Magento coding standard check | ||
- vendor/bin/phpcs -s --standard=./ruleset.xml src/ | ||
# Install magento | ||
- if [[ $TEST_GROUP = magento_242 ]]; then NAME=disablestockres VERSION=2.4.2 . ./vendor/bin/travis-install-magento.sh; fi | ||
- if [[ $TEST_GROUP = magento_23 ]]; then NAME=disablestockres VERSION=2.3.7-p2 . ./vendor/bin/travis-install-magento.sh; fi | ||
- if [[ $TEST_GROUP = magento_latest ]]; then magerun2 self-update; fi | ||
- if [[ $TEST_GROUP = magento_latest ]]; then NAME=disablestockres . ./vendor/bin/travis-install-magento.sh; fi | ||
# Install this module | ||
- cd vendor/ampersand/travis-vanilla-magento/instances/disablestockres | ||
- export COMPOSER_MEMORY_LIMIT=-1 | ||
- composer config repo.disablestockres git "../../../../../" | ||
- composer require -vvv ampersand/magento2-disable-stock-reservation:"dev-$TRAVIS_BRANCH" || composer require -vvv ampersand/magento2-disable-stock-reservation $TRAVIS_BRANCH | ||
- php bin/magento setup:upgrade | ||
# compile magento | ||
- php bin/magento setup:di:compile | ||
# Set up test configuration | ||
- magerun2 config:store:set oauth/consumer/enable_integration_as_bearer 1 | ||
- magerun2 config:store:set checkout/options/guest_checkout 1 | ||
- magerun2 config:store:set payment/checkmo/active 1 | ||
- magerun2 integration:create disablestockres [email protected] https://example.com --access-token="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | ||
- magerun2 cache:flush | ||
# warm caches | ||
- php bin/magento | ||
- magerun2 sys:info | ||
- cd - | ||
|
||
before_install: | ||
- if [ ! "$TRAVIS_PULL_REQUEST" = "false" ]; then git branch; git branch -D "$TRAVIS_BRANCH" || true; git checkout -b "$TRAVIS_BRANCH"; fi | ||
- composer self-update --2 | ||
- mkdir -p $HOME/bin/ | ||
# Install magerun2 | ||
- test -f $HOME/bin/magerun2 || (mkdir -p $HOME/bin/ && wget https://files.magerun.net/n98-magerun2-4.9.1.phar && chmod +x n98-magerun2-4.9.1.phar && mv n98-magerun2-4.9.1.phar $HOME/bin/magerun2) | ||
|
||
- CURRENT_EXTENSION="." FULL_INSTALL=1 vendor/bin/mtest-make $TEST_GROUP | ||
|
||
script: | ||
- ADDITIONAL_ARGS="-v" | ||
- if [[ $TRAVIS_COMMIT_MESSAGE == *"VERBOSE"* ]]; then ADDITIONAL_ARGS="-vvv"; fi; | ||
- ./vendor/bin/codecept build -c dev | ||
- URL="https://magento-disablestockres.localhost/" MYSQL_USER="root" MYSQL_HOST="127.0.0.1" MYSQL_DB="databasedisablestockres" MYSQL_PORT="3306" ./vendor/bin/codecept run acceptance -c dev $ADDITIONAL_ARGS | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- postfix | ||
- apache2 | ||
- libapache2-mod-fastcgi | ||
|
||
services: | ||
- mysql | ||
- elasticsearch | ||
- composer docker-configure-magento | ||
- composer docker-run-codeception | ||
|
||
cache: | ||
apt: true | ||
directories: | ||
- $HOME/.composer/cache | ||
- $HOME/bin | ||
|
||
after_failure: | ||
- test -d ./vendor/ampersand/travis-vanilla-magento/instances/disablestockres/var/report/ && for r in ./vendor/ampersand/travis-vanilla-magento/instances/disablestockres/var/report/*; do cat $r; done | ||
- test -f ./vendor/ampersand/travis-vanilla-magento/instances/disablestockres/var/log/system.log && grep -v "Broken reference" ./vendor/ampersand/travis-vanilla-magento/instances/disablestockres/var/log/system.log | ||
- test -f ./vendor/ampersand/travis-vanilla-magento/instances/disablestockres/var/log/exception.log && cat ./vendor/ampersand/travis-vanilla-magento/instances/disablestockres/var/log/exception.log | ||
- test -f ./vendor/ampersand/travis-vanilla-magento/instances/disablestockres/var/log/support_report.log && grep -v "Broken reference" ./vendor/ampersand/travis-vanilla-magento/instances/disablestockres/var/log/support_report.log | ||
- vendor/bin/mtest 'for r in /var/www/html/var/report/*; do cat $r; done' | ||
- vendor/bin/mtest 'cat /var/www/html/var/log/*.log' | ||
- docker ps | ||
- sleep 10; # give log files time to render |
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 |
---|---|---|
|
@@ -30,12 +30,23 @@ | |
"codeception/module-phpbrowser": "^1.0.0", | ||
"codeception/module-asserts": "^1.1.0", | ||
"codeception/module-db": "^1.0.1", | ||
"ampersand/travis-vanilla-magento": "^1.0", | ||
"ampersand/magento-docker-test-instance": "^0.1", | ||
"codeception/module-rest": "^1.2.0", | ||
"friendsofphp/php-cs-fixer": "^2.16", | ||
"magento/magento-coding-standard": "<16" | ||
}, | ||
"scripts": { | ||
"docker-configure-magento": [ | ||
"vendor/bin/mtest 'vendor/bin/n98-magerun2 config:store:set checkout/options/guest_checkout 1'", | ||
"vendor/bin/mtest 'vendor/bin/n98-magerun2 config:store:set payment/checkmo/active 1'", | ||
"vendor/bin/mtest 'vendor/bin/n98-magerun2 config:store:set oauth/consumer/enable_integration_as_bearer 1'", | ||
"vendor/bin/mtest 'vendor/bin/n98-magerun2 integration:create disablestockres [email protected] https://example.com --access-token=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'", | ||
"vendor/bin/mtest 'php bin/magento cache:flush'", | ||
"vendor/bin/mtest 'php bin/magento --version'" | ||
], | ||
"docker-run-codeception": [ | ||
"URL=\"http://0.0.0.0:1234/\" MYSQL_USER=\"root\" MYSQL_HOST=\"0.0.0.0\" MYSQL_DB=\"magento\" MYSQL_PORT=\"1235\" ./dev/run-codeception.sh" | ||
], | ||
"post-install-cmd": [ | ||
"([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)" | ||
], | ||
|
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,23 @@ | ||
**Do not run these tests in production, they delete from and insert into your database as well as generate an integration token.** | ||
|
||
To run these tests locally you will need to get a copy of the repo | ||
``` | ||
git clone https://github.com/AmpersandHQ/magento2-disable-stock-reservation/ | ||
cd magento2-disable-stock-reservation | ||
``` | ||
|
||
Boot the docker test instance for testing against (run `./vendor/bin/mtest-make` to see supported versions) | ||
``` | ||
CURRENT_EXTENSION="." FULL_INSTALL=1 vendor/bin/mtest-make 2-4-5 | ||
``` | ||
|
||
Configure magento test settings | ||
``` | ||
composer docker-configure-magento | ||
``` | ||
|
||
Run the tests | ||
``` | ||
composer docker-run-codeception | ||
``` | ||
|
This file was deleted.
Oops, something went wrong.
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