Skip to content

Commit

Permalink
Generate tests and remove filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmollenhour authored and tmotyl committed May 18, 2020
1 parent 8ff94e7 commit 2aed58c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ before_install: ./dev/travis/before_install.sh
install: if [ $TEST_SUITE == "functional" ]; then composer install --no-interaction; fi
before_script: ./dev/travis/before_script.sh
script:
- test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true
- if [ $TEST_SUITE == "static" ]; then ! find . -not \( -path ./.phpstorm.meta.php -prune \) -not \( -path ./lib/PEAR -prune \) -not \( -path ./lib/phpseclib -prune \) -not \( -path ./lib/Zend -prune \) -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"; fi
- if [ $TEST_SUITE == "static" ]; then ! find app/design -type f -name "*.phtml" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"; fi
- if [ $TEST_SUITE == "functional" ]; then dev/tests/functional/vendor/phpunit/phpunit/phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE == "functional" ]; then dev/tests/functional/vendor/phpunit/phpunit/phpunit -c dev/tests/$TEST_SUITE; fi
1 change: 1 addition & 0 deletions dev/tests/functional/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vendor
generated
9 changes: 9 additions & 0 deletions dev/tests/functional/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ docker run --rm -it \
composer --ignore-platform-reqs install
```

Then generate tests using PHP:

```sh
docker run --rm -it \
--volume $(realpath $PWD/../../../):/app --workdir /app \
php:7.2 \
php -f dev/tests/functional/utils/generate.php
```

Run tests:

```sh
Expand Down
27 changes: 26 additions & 1 deletion dev/tests/functional/utils/mtf
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,29 @@
$mtfRoot = dirname(__DIR__);
$mtfRoot = str_replace('\\', '/', $mtfRoot);
define('MTF_PHPUNIT_FILE', $mtfRoot . DIRECTORY_SEPARATOR . 'phpunit.xml');
include $mtfRoot . '/vendor/magento/mtf/utils/mtf';

if (PHP_SAPI !== 'cli') {
echo 'utils/mtf must be run as a CLI application';
exit(1);
}

try {
require __DIR__ . DIRECTORY_SEPARATOR . 'bootstrap.php';
} catch (\Exception $e) {
echo 'Autoload error: ' . $e->getMessage();
exit(1);
}
try {
#$handler = new \Magento\Framework\App\ErrorHandler();
#set_error_handler([$handler, 'handler']);
$application = $objectManager->create('Magento\Mtf\Console\Cli');
$application->run();
} catch (\Exception $e) {
while ($e) {
echo $e->getMessage();
echo $e->getTraceAsString();
echo "\n\n";
$e = $e->getPrevious();
}
exit(1);
}
3 changes: 3 additions & 0 deletions dev/travis/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ case $TEST_SUITE in
cp ./phpunit.xml.dist ./phpunit.xml
sed -e "s?127.0.0.1?${MAGENTO_HOST_NAME}?g" --in-place ./phpunit.xml
sed -e "s?basic?travis_acceptance?g" --in-place ./phpunit.xml

php -f utils/generate.php

cd ./utils
#php -f mtf troubleshooting:check-all

Expand Down

0 comments on commit 2aed58c

Please sign in to comment.