Commit 236abe32 by Carsten Brandt

Merge pull request #2663 from Theill11/travis-advanced-app

Added advanced app tests to travis
parents 4384a968 f528cc9f
...@@ -31,7 +31,16 @@ install: ...@@ -31,7 +31,16 @@ install:
- composer install --dev --prefer-dist -d apps/basic - composer install --dev --prefer-dist -d apps/basic
- cd apps/basic && composer require --dev codeception/codeception:1.8.*@dev codeception/specify:* codeception/verify:* - cd apps/basic && composer require --dev codeception/codeception:1.8.*@dev codeception/specify:* codeception/verify:*
- php vendor/bin/codecept build && cd ../.. - php vendor/bin/codecept build && cd ../..
- cd apps && php -S localhost:8080 & # advanced application:
- composer install --dev --prefer-dist -d apps/advanced
- cd apps/advanced && composer require --dev codeception/codeception:1.8.*@dev codeception/specify:* codeception/verify:*
- ./init --env=Development
- sed -i s/root/travis/ common/config/main-local.php
- cd backend && php ../vendor/bin/codecept build
- cd ../common && php ../vendor/bin/codecept build
- cd ../frontend && php ../vendor/bin/codecept build && cd ../../..
# boot server
- cd apps && php -S localhost:8080 > /dev/null 2>&1 &
before_script: before_script:
- echo 'elasticsearch version ' && curl http://localhost:9200/ - echo 'elasticsearch version ' && curl http://localhost:9200/
...@@ -39,13 +48,21 @@ before_script: ...@@ -39,13 +48,21 @@ before_script:
- psql -U postgres -c 'CREATE DATABASE yiitest;'; - psql -U postgres -c 'CREATE DATABASE yiitest;';
- tests/unit/data/travis/sphinx-setup.sh - tests/unit/data/travis/sphinx-setup.sh
- mongo yii2test --eval 'db.addUser("travis", "test");' - mongo yii2test --eval 'db.addUser("travis", "test");'
- mysql -e 'CREATE DATABASE yii2_advanced_acceptance;';
- mysql -e 'CREATE DATABASE yii2_advanced_functional;';
- mysql -e 'CREATE DATABASE yii2_advanced_unit;';
- cd apps/advanced/frontend/tests/acceptance && php yii migrate --interactive=0
- cd ../functional && php yii migrate --interactive=0
- cd ../unit && php yii migrate --interactive=0 && cd ../../../../..
script: script:
- vendor/bin/phpunit --verbose --coverage-clover=coverage.clover --exclude-group mssql,oci,wincache,xcache,zenddata - vendor/bin/phpunit --verbose --coverage-clover=coverage.clover --exclude-group mssql,oci,wincache,xcache,zenddata
- cd apps/basic && php vendor/bin/codecept run - cd apps/basic && php vendor/bin/codecept run
- cd ../advanced/backend && ../vendor/bin/codecept run
- cd ../common && ../vendor/bin/codecept run
- cd ../frontend && ../vendor/bin/codecept run
after_script: after_script:
- cd ../.. - cd ../../..
- pwd
- wget https://scrutinizer-ci.com/ocular.phar - wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover - php ocular.phar code-coverage:upload --format=php-clover coverage.clover
...@@ -111,8 +111,9 @@ To make your database up to date, you can run in needed test folder `yii migrate ...@@ -111,8 +111,9 @@ To make your database up to date, you can run in needed test folder `yii migrate
if you are starting from `frontend` tests then you should run `yii migrate` in each suite folder `acceptance`, `functional`, `unit` if you are starting from `frontend` tests then you should run `yii migrate` in each suite folder `acceptance`, `functional`, `unit`
it will upgrade your database to the last state according migrations. it will upgrade your database to the last state according migrations.
To be able to run acceptance tests you should configure your server to point doc_root to your new created application. For example if we To be able to run acceptance tests you need a running webserver. For this you can use the php bultin server and run it in the directory where your main project folder is located. For example if your application is located in `/www/advanced` all you need to is:
use php builtin server, then all that is needed to do is run `php -S 127.0.0.1:8080` in main project directory - directory that contains `frontend`, `backend`, `common`, `console` directories. `cd /www` and then `php -S 127.0.0.1:8080` because the default configuration of acceptance tests expects the url of the application to be `/advanced/`.
If you already have a server configured or your application is not located in a folder called `advanced`, you may need to adjust the `TEST_ENTRY_URL` in `frontend/tests/_bootstrap.php` and `backend/tests/_bootstrap.php`.
After that is done you should be able to run your tests, for example to run `frontend` tests do: After that is done you should be able to run your tests, for example to run `frontend` tests do:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// the entry script URL (without host info) for functional and acceptance tests // the entry script URL (without host info) for functional and acceptance tests
// PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL // PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
defined('TEST_ENTRY_URL') or define('TEST_ENTRY_URL', '/backend/web/index-test.php'); defined('TEST_ENTRY_URL') or define('TEST_ENTRY_URL', '/advanced/backend/web/index-test.php');
// the entry script file path for functional and acceptance tests // the entry script file path for functional and acceptance tests
defined('TEST_ENTRY_FILE') or define('TEST_ENTRY_FILE', dirname(__DIR__) . '/web/index-test.php'); defined('TEST_ENTRY_FILE') or define('TEST_ENTRY_FILE', dirname(__DIR__) . '/web/index-test.php');
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// the entry script URL (without host info) for functional and acceptance tests // the entry script URL (without host info) for functional and acceptance tests
// PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL // PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
defined('TEST_ENTRY_URL') or define('TEST_ENTRY_URL', '/frontend/web/index-test.php'); defined('TEST_ENTRY_URL') or define('TEST_ENTRY_URL', '/advanced/frontend/web/index-test.php');
// the entry script file path for functional and acceptance tests // the entry script file path for functional and acceptance tests
defined('TEST_ENTRY_FILE') or define('TEST_ENTRY_FILE', dirname(__DIR__) . '/web/index-test.php'); defined('TEST_ENTRY_FILE') or define('TEST_ENTRY_FILE', dirname(__DIR__) . '/web/index-test.php');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment