language: php # We require precise here, as 5.3 doesn't exist on trusty. dist: precise php: - 5.3 - 5.4 - 5.5 - 5.6 - 7.0 - 7.1 - 7.2 env: matrix: - DB=mysql global: - PHPUNIT=3.7.33 services: - memcached matrix: fast_finish: true include: - php: 5.3 env: DB=mysql PHPUNIT=4.8.35 - php: 5.4 env: DB=pgsql - php: 5.4 env: DB=sqlite - php: 7.0 env: PHPCS=1 - php: 7.1 env: DB=mysql PHPUNIT=5.7.19 - php: 7.2 env: DB=mysql PHPUNIT=5.7.19 exclude: - php: 7.2 env: DB=mysql before_script: - if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.2" ]] ; then pear config-set preferred_state snapshot && yes "" | pecl install mcrypt ; fi - composer require "phpunit/phpunit=$PHPUNIT" - echo "require_once 'vendors/autoload.php';" >> app/Config/bootstrap.php - sudo locale-gen de_DE - sudo locale-gen es_ES - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test2;'; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test3;'; fi" - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test2;' -U postgres -d cakephp_test; fi" - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi" - chmod -R 777 ./app/tmp - if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.3" ]] ; then pecl install timezonedb ; fi - sh -c "if [ '$PHPCS' = '1' ]; then composer require 'cakephp/cakephp-codesniffer:1.*'; fi" - sh -c "if [ '$PHPCS' = '1' ]; then vendors/bin/phpcs --config-set installed_paths vendors/cakephp/cakephp-codesniffer; fi" - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]] ; then echo "yes" | pecl install apcu-5.1.3 || true; fi - if [[ ${TRAVIS_PHP_VERSION:0:1} == "5" ]] ; then echo "yes" | pecl install apcu-4.0.11 || true; fi - echo -e "extension = apcu.so\napc.enable_cli=1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - phpenv rehash - set +H - echo " array( 'datasource' => 'Database/Mysql', 'host' => '127.0.0.1', 'login' => 'root' ), 'pgsql' => array( 'datasource' => 'Database/Postgres', 'host' => '127.0.0.1', 'login' => 'postgres', 'database' => 'cakephp_test', 'schema' => array( 'default' => 'public', 'test' => 'public', 'test2' => 'test2', 'test_database_three' => 'test3' ) ), 'sqlite' => array( 'datasource' => 'Database/Sqlite', 'database' => array( 'default' => ':memory:', 'test' => ':memory:', 'test2' => '/tmp/cakephp_test2.db', 'test_database_three' => '/tmp/cakephp_test3.db' ), ) ); public \$default = array( 'persistent' => false, 'host' => '', 'login' => '', 'password' => '', 'database' => 'cakephp_test', 'prefix' => '' ); public \$test = array( 'persistent' => false, 'host' => '', 'login' => '', 'password' => '', 'database' => 'cakephp_test', 'prefix' => '' ); public \$test2 = array( 'persistent' => false, 'host' => '', 'login' => '', 'password' => '', 'database' => 'cakephp_test2', 'prefix' => '' ); public \$test_database_three = array( 'persistent' => false, 'host' => '', 'login' => '', 'password' => '', 'database' => 'cakephp_test3', 'prefix' => '' ); public function __construct() { \$db = 'mysql'; if (!empty(\$_SERVER['DB'])) { \$db = \$_SERVER['DB']; } foreach (array('default', 'test', 'test2', 'test_database_three') as \$source) { \$config = array_merge(\$this->{\$source}, \$this->identities[\$db]); if (is_array(\$config['database'])) { \$config['database'] = \$config['database'][\$source]; } if (!empty(\$config['schema']) && is_array(\$config['schema'])) { \$config['schema'] = \$config['schema'][\$source]; } \$this->{\$source} = \$config; } } }" > app/Config/database.php script: - sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; fi" - sh -c "if [ '$PHPCS' = '1' ]; then vendors/bin/phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; fi;" notifications: email: false