Skip to content

Commit 87f6cf9

Browse files
committed
Update travis config
1 parent fabdaa5 commit 87f6cf9

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

.travis.yml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,25 @@ language: php
22

33
php:
44
- 5.6
5-
- 7.0
6-
- 7.1
7-
- 7.2
5+
- 7.4
86

9-
dist: trusty
10-
11-
sudo: false
7+
services:
8+
- postgresql
9+
- mysql
1210

1311
env:
1412
global:
1513
- DEFAULT=1
16-
- CODECOVERAGE=0
14+
matrix:
15+
- DB=mysql DB_DSN='mysql://[email protected]/cakephp_test?init[]=SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'
16+
- DB=pgsql DB_DSN='postgres://[email protected]/cakephp_test'
17+
- DB=sqlite DB_DSN='sqlite:///:memory:'
1718

1819
matrix:
1920
fast_finish: true
2021

2122
include:
22-
- php: 7.2
23-
env: CODECOVERAGE=1 DEFAULT=0
24-
25-
- php: 7.0
23+
- php: 7.4
2624
env: PHPCS=1 DEFAULT=0
2725

2826
- php: 7.1
@@ -31,22 +29,30 @@ matrix:
3129
- php: 5.6
3230
env: PREFER_LOWEST=1
3331

34-
before_script:
35-
- if [[ $TRAVIS_PHP_VERSION != 7.0 ]]; then phpenv config-rm xdebug.ini; fi
32+
before_install:
33+
- if [[ $DB == 'mysql' ]]; then mysql -u root -e 'CREATE DATABASE cakephp_test;'; fi
34+
- if [[ $DB == 'pgsql' ]]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi
35+
36+
install:
37+
- if [[ $TRAVIS_PHP_VERSION != 7.4 ]]; then phpenv config-rm xdebug.ini; fi
3638

37-
- if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.11; fi
3839
- if [[ $PHPSTAN != 1 ]]; then composer install --no-interaction; fi
40+
- |
41+
if [[ $PHPSTAN == 1 ]]; then
42+
composer require phpstan/phpstan:^0.12
43+
composer install --no-dev
44+
fi
3945
4046
script:
41-
- if [[ $CODECOVERAGE = 1 ]]; then ./vendor/bin/phpunit --coverage-clover=clover.xml; fi
42-
- if [[ $DEFAULT = 1 ]]; then ./vendor/bin/phpunit; fi
47+
- if [[ $TRAVIS_PHP_VERSION == 7.4 ]]; then ./vendor/bin/phpunit --coverage-clover=clover.xml; fi
48+
- if [[ $DEFAULT == 1 ]]; then ./vendor/bin/phpunit; fi
4349

44-
- if [[ $PHPCS = 1 ]]; then ./vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi
50+
- if [[ $PHPCS == 1 ]]; then ./vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi
4551

46-
- if [[ $PHPSTAN = 1 ]]; then vendor/bin/phpstan analyse src; fi
52+
- if [[ $PHPSTAN == 1 ]]; then vendor/bin/phpstan analyse src; fi
4753

4854
after_success:
49-
- if [[ $CODECOVERAGE = 1 ]]; then bash <(curl -s https://codecov.io/bash); fi
55+
- if [[ $TRAVIS_PHP_VERSION == 7.4 ]]; then bash <(curl -s https://codecov.io/bash); fi
5056

5157
notifications:
5258
email: false

tests/bootstrap.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,12 @@
8585
],
8686
]);
8787

88-
$config = [
89-
'url' => 'sqlite:/' . TMP . 'webservice_test.sqlite',
90-
'timezone' => 'UTC',
91-
];
88+
if (!getenv('DB_DSN')) {
89+
putenv('DB_DSN=sqlite:///:memory:');
90+
}
9291

93-
// Use the test connection for 'debug_kit' as well.
94-
ConnectionManager::setConfig('test', $config);
95-
ConnectionManager::setConfig('test_webservice', $config);
92+
ConnectionManager::setConfig('test', ['url' => getenv('DB_DSN')]);
93+
ConnectionManager::setConfig('test_webservice', ['url' => getenv('DB_DSN')]);
9694

9795
Log::setConfig([
9896
'debug' => [

0 commit comments

Comments
 (0)