-
Notifications
You must be signed in to change notification settings - Fork 255
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 #521 from FriendsOfCake/travis
Update travis config.
- Loading branch information
Showing
10 changed files
with
65 additions
and
147 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 |
---|---|---|
|
@@ -2,59 +2,56 @@ language: php | |
|
||
php: | ||
- 5.6 | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
|
||
sudo: false | ||
- 7.3 | ||
|
||
env: | ||
matrix: | ||
- DB=mysql db_dsn='mysql://travis@0.0.0.0/cakephp_test' | ||
- DB=mysql db_dsn='mysql://root@127.0.0.1/cakephp_test' | ||
- DB=pgsql db_dsn='postgres://[email protected]/cakephp_test' | ||
- DB=sqlite db_dsn='sqlite:///:memory:' | ||
|
||
global: | ||
- DEFAULT=1 | ||
|
||
matrix: | ||
allow_failures: | ||
- php: hhvm | ||
|
||
fast_finish: true | ||
|
||
include: | ||
- php: 5.6 | ||
- php: 7.3 | ||
env: PHPCS=1 DEFAULT=0 | ||
|
||
- php: 5.6 | ||
env: COVERALLS=1 DEFAULT=0 | ||
|
||
- php: hhvm | ||
env: HHVM=1 DB=sqlite db_dsn='sqlite:///:memory:' | ||
|
||
- php: hhvm | ||
env: HHVM=1 DB=mysql db_dsn='mysql://[email protected]/cakephp_test' | ||
env: PREFER_LOWEST=1 | ||
|
||
before_script: | ||
- composer self-update | ||
- composer install --prefer-source --no-interaction | ||
|
||
- sh -c "if [ '$DB' = 'mysql' ]; then if [ '$DOCKER' = '1' ]; then apt-get -qq install -qq -y mysql-server && service mysql start; fi; mysql -e 'CREATE DATABASE cakephp_test;'; fi" | ||
|
||
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi" | ||
|
||
- sh -c "if [ '$PHPCS' = '1' ]; then composer require 'cakephp/cakephp-codesniffer:dev-master'; fi" | ||
- if [[ $TRAVIS_PHP_VERSION != 7.3 ]]; then phpenv config-rm xdebug.ini; fi | ||
|
||
- sh -c "if [ '$COVERALLS' = '1' ]; then composer require --dev satooshi/php-coveralls; fi" | ||
- sh -c "if [ '$COVERALLS' = '1' ]; then mkdir -p build/logs; fi" | ||
- if [[ $PREFER_LOWEST != 1 ]]; then composer update --no-interaction; fi | ||
- if [[ $PREFER_LOWEST == 1 ]]; then composer update --no-interaction --prefer-lowest --prefer-stable; fi | ||
|
||
- command -v phpenv > /dev/null && phpenv rehash || true | ||
- if [[ $DB = 'mysql' ]]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi | ||
- if [[ $DB = 'pgsql' ]]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi | ||
|
||
script: | ||
- sh -c "if [ '$COVERALLS' = '1' ]; then vendor/bin/phpunit --stderr --coverage-clover build/logs/clover.xml; fi" | ||
- sh -c "if [ '$COVERALLS' = '1' ]; then php vendor/bin/php-coveralls -v; fi" | ||
- sh -c "if [ '$DEFAULT' = '1' ]; then vendor/bin/phpunit --stderr; fi" | ||
- sh -c "if [ '$PHPCS' = '1' ]; then vendor/bin/phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi" | ||
- | | ||
if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.3 ]]; then | ||
mkdir -p build/logs | ||
vendor/bin/phpunit --coverage-clover=build/logs/clover.xml | ||
fi | ||
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION != 7.3 ]]; then vendor/bin/phpunit; fi | ||
|
||
- if [[ $PHPCS = 1 ]]; then vendor/bin/phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi | ||
|
||
after_success: | ||
- | | ||
if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.3 ]]; then | ||
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar | ||
chmod +x php-coveralls.phar | ||
./php-coveralls.phar | ||
fi | ||
notifications: | ||
email: false |
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
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
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,77 +1,24 @@ | ||
<?php | ||
// @codingStandardsIgnoreFile | ||
|
||
$findRoot = function () { | ||
$root = __DIR__; | ||
for ($i = 0; $i < 3; $i++) { | ||
/* | ||
* Test suite bootstrap | ||
* | ||
* This function is used to find the location of CakePHP whether CakePHP | ||
* has been installed as a dependency of the plugin, or the plugin is itself | ||
* installed as a dependency of an application. | ||
*/ | ||
$findRoot = function ($root) { | ||
do { | ||
$lastRoot = $root; | ||
$root = dirname($root); | ||
if (is_dir($root . '/vendor/cakephp/cakephp')) { | ||
return $root; | ||
} | ||
} | ||
} while ($root !== $lastRoot); | ||
throw new Exception('Cannot find the root of the application, unable to run tests'); | ||
}; | ||
|
||
if (!defined('DS')) { | ||
define('DS', DIRECTORY_SEPARATOR); | ||
} | ||
define('ROOT', $findRoot()); | ||
define('APP_DIR', 'App'); | ||
define('WEBROOT_DIR', 'webroot'); | ||
define('APP', ROOT . '/tests/App/'); | ||
define('CONFIG', ROOT . '/tests/config/'); | ||
define('WWW_ROOT', ROOT . DS . WEBROOT_DIR . DS); | ||
define('TESTS', ROOT . DS . 'tests' . DS); | ||
define('TMP', ROOT . DS . 'tmp' . DS); | ||
define('LOGS', TMP . 'logs' . DS); | ||
define('CACHE', TMP . 'cache' . DS); | ||
define('CAKE_CORE_INCLUDE_PATH', ROOT . '/vendor/cakephp/cakephp'); | ||
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); | ||
define('CAKE', CORE_PATH . 'src' . DS); | ||
|
||
require ROOT . '/vendor/autoload.php'; | ||
require CORE_PATH . 'config/bootstrap.php'; | ||
|
||
Cake\Core\Configure::write('App', ['namespace' => 'App']); | ||
Cake\Core\Configure::write('debug', true); | ||
|
||
$TMP = new \Cake\Filesystem\Folder(TMP); | ||
$TMP->create(TMP . 'cache/models', 0777); | ||
$TMP->create(TMP . 'cache/persistent', 0777); | ||
$TMP->create(TMP . 'cache/views', 0777); | ||
|
||
$cache = [ | ||
'default' => [ | ||
'engine' => 'File' | ||
], | ||
'_cake_core_' => [ | ||
'className' => 'File', | ||
'prefix' => 'upload_myapp_cake_core_', | ||
'path' => CACHE . 'persistent/', | ||
'serialize' => true, | ||
'duration' => '+10 seconds' | ||
], | ||
'_cake_model_' => [ | ||
'className' => 'File', | ||
'prefix' => 'upload_my_app_cake_model_', | ||
'path' => CACHE . 'models/', | ||
'serialize' => 'File', | ||
'duration' => '+10 seconds' | ||
] | ||
]; | ||
|
||
Cake\Cache\Cache::setConfig($cache); | ||
Cake\Core\Configure::write('Session', [ | ||
'defaults' => 'php' | ||
]); | ||
|
||
\Cake\Core\Plugin::getCollection()->add(new \Josegonzalez\Upload\Plugin); | ||
|
||
// Ensure default test connection is defined | ||
if (!getenv('db_dsn')) { | ||
putenv('db_dsn=sqlite:///:memory:'); | ||
} | ||
$root = $findRoot(__FILE__); | ||
unset($findRoot); | ||
chdir($root); | ||
|
||
Cake\Datasource\ConnectionManager::setConfig('test', [ | ||
'url' => getenv('db_dsn'), | ||
'timezone' => 'UTC' | ||
]); | ||
require $root . '/vendor/cakephp/cakephp/tests/bootstrap.php'; |