Skip to content

Instantly share code, notes, and snippets.

@rrd108
Last active November 18, 2017 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rrd108/d366cca7feb33825e6989ba3fad049de to your computer and use it in GitHub Desktop.
Save rrd108/d366cca7feb33825e6989ba3fad049de to your computer and use it in GitHub Desktop.
CakePHP Travis MySQL 5.7
echo mysql-apt-config mysql-apt-config/select-server select mysql-5.7 | sudo debconf-set-selections
wget https://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
sudo dpkg --install mysql-apt-config_0.7.3-1_all.deb
sudo apt-get update -q
sudo apt-get install -q -y --allow-unauthenticated -o Dpkg::Options::=--force-confnew mysql-server
sudo mysql_upgrade
language: php
dist: trusty
sudo: true
php:
- 5.6
- 7.0
- 7.1
env:
- DB=mysql db_dsn='mysql://root@127.0.0.1/cakephp_test'
services:
- mysql
matrix:
fast_finish: true
before_script:
- bash .travis.install-mysql-5.7.sh
- mysql -u root -e "CREATE DATABASE cakephp_test;"
- composer update;
- composer run-script post-install-cmd --no-interaction;
script:
- vendor/bin/phpunit;
notifications:
email: false
<?php
// at Datasources, around line 266
'test' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
//'port' => 'non_standard_port_number',
'username' => 'root',
'password' => '',
'database' => 'cakephp_test',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
'quoteIdentifiers' => false,
'log' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_TEST_URL', null),
],
...
"require-dev": {
...
"phpunit/phpunit": "^5.7|^6.0"
},
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment