File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed
Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ sudo: false
1313
1414env :
1515 matrix :
16- - DB=mysql db_dsn='mysql://travis@127 .0.0.1/ cakephp_test'
16+ - DB=mysql db_user=root db_host=0 .0.0.0 db_name= cakephp_test
1717
1818 global :
1919 - DEFAULT=1 PREFER_LOWEST="--prefer-lowest"
@@ -23,10 +23,10 @@ matrix:
2323
2424 include :
2525 - php : 7.3
26- env : PREFER_LOWEST=""
26+ env : PREFER_LOWEST="" DB=mysql db_user=root db_host=0.0.0.0 db_name=cakephp_test
2727
2828 - php : ' 7.4snapshot'
29- env : PREFER_LOWEST=""
29+ env : PREFER_LOWEST="" DB=mysql db_user=root db_host=0.0.0.0 db_name=cakephp_test
3030
3131 - php : 7.3
3232 env : PHPCS=1 DEFAULT=0 PREFER_LOWEST="
Original file line number Diff line number Diff line change 2727
2828 return ;
2929}
30- require $ root . '/vendor/cakephp/cakephp/tests/bootstrap.php ' ;
30+
31+ // With PHP7.3 & CakePHP 3.5.0, StaticConfigTrait::parseDsn causes the error in preg_match
32+ // (It has benn fixed in 3.5.1 https://github.com/cakephp/cakephp/commit/91475ccfa58948b2561ffd9631664c1c3edaf300)
33+ // In place of using `db_dsn` uri, set db config with array.
34+ if (getenv ('DB ' ) === 'mysql ' ) {
35+ $ dbConfig = [
36+ 'className ' => \Cake \Database \Connection::class,
37+ 'driver ' => \Cake \Database \Driver \Mysql::class,
38+ 'host ' => getenv ('db_host ' ),
39+ 'username ' => getenv ('db_user ' ),
40+ 'database ' => getenv ('db_name ' ),
41+ 'url ' => null ,
42+ ];
43+ \Cake \Datasource \ConnectionManager::setConfig ('test ' , $ dbConfig );
44+ \Cake \Datasource \ConnectionManager::setConfig ('test_custom_i18n_datasource ' , $ dbConfig );
45+ try {
46+ require $ root . '/vendor/cakephp/cakephp/tests/bootstrap.php ' ;
47+ } catch (\BadMethodCallException $ e ) {
48+ if (strpos ($ e ->getMessage (), 'Cannot reconfigure existing key ' ) !== 0 ) {
49+ throw $ e ;
50+ }
51+ }
52+ } else {
53+ require $ root . '/vendor/cakephp/cakephp/tests/bootstrap.php ' ;
54+ }
You can’t perform that action at this time.
0 commit comments