Skip to content

Commit 801c58d

Browse files
committed
Merge branch 'master' into cake-4.x
2 parents f3ee55c + 87f6cf9 commit 801c58d

File tree

4 files changed

+35
-25
lines changed

4 files changed

+35
-25
lines changed

.travis.yml

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

33
php:
44
- 7.2
5-
- 7.3
65
- 7.4
76

8-
dist: xenial
7+
services:
8+
- postgresql
9+
- mysql
910

1011
env:
1112
global:
1213
- DEFAULT=1
13-
14-
services:
15-
- mysql
16-
- postgresql
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+
- php: 7.4
2324
env: PHPCS=1 DEFAULT=0
2425

2526
- php: 7.2
@@ -28,24 +29,32 @@ matrix:
2829
- php: 7.2
2930
env: PREFER_LOWEST=1 DEFAULT=0
3031

31-
before_script:
32-
- if [[ $TRAVIS_PHP_VERSION != 7.3 ]]; 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 [[ $DB != 'mysql' && $TRAVIS_PHP_VERSION != 7.4 ]]; then phpenv config-rm xdebug.ini; fi
3338

34-
- if [[ $STATIC_ANALYSIS == 1 ]]; then composer require --dev phpstan/phpstan:^0.12 psalm/phar:^3.7; fi
35-
- if [[ $PREFER_LOWEST == 1 ]]; then composer update --no-interaction --prefer-lowest --prefer-stable --prefer-dist; fi
36-
- if [[ $PREFER_LOWEST != 1 ]]; then composer install --no-interaction; fi
39+
- if [[ $STATIC_ANALYSIS != 1 ]]; then composer install --no-interaction; fi
40+
- |
41+
if [[ $STATIC_ANALYSIS == 1 ]]; then
42+
composer require phpstan/phpstan:^0.12
43+
composer require psalm/phar:^3.7
44+
composer install --no-dev
45+
fi
3746
3847
script:
39-
- if [[ $TRAVIS_PHP_VERSION == 7.3 ]]; then ./vendor/bin/phpunit --coverage-clover=clover.xml; fi
40-
- if [[ $DEFAULT == 1 || $PREFER_LOWEST == 1 ]]; then ./vendor/bin/phpunit; fi
48+
- if [[ $DB == 'mysql' && $TRAVIS_PHP_VERSION == 7.4 ]]; then ./vendor/bin/phpunit --coverage-clover=clover.xml; fi
49+
- if [[ $DEFAULT == 1 ]]; then ./vendor/bin/phpunit; fi
4150

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

44-
- if [[ $STATIC_ANALYSIS == 1 ]]; then vendor/bin/phpstan.phar analyse src; fi
45-
- if [[ $STATIC_ANALYSIS == 1 ]]; then vendor/bin/psalm.phar analyse src; fi
53+
- if [[ $STATIC_ANALYSIS == 1 ]]; then vendor/bin/phpstan analyse src; fi
54+
- if [[ $STATIC_ANALYSIS == 1 ]]; then vendor/bin/psalm.phar; fi
4655

4756
after_success:
48-
- if [[ $TRAVIS_PHP_VERSION == 7.3 ]]; then bash <(curl -s https://codecov.io/bash); fi
57+
- if [[ $DB == 'mysql' && $TRAVIS_PHP_VERSION == 7.4 ]]; then bash <(curl -s https://codecov.io/bash); fi
4958

5059
notifications:
5160
email: false

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parameters:
22
level: 6
3-
checkGenericClassInNonGenericObjectType: false
43
checkMissingIterableValueType: false
4+
checkGenericClassInNonGenericObjectType: false
55
ignoreErrors:
66
-
77
message: "#^Call to an undefined method Cake\\\\Datasource\\\\RepositoryInterface\\:\\:callFinder\\(\\)\\.$#"

src/Model/Endpoint.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,9 @@ public function getResourceClass(): string
499499
$name = implode('\\', array_slice($parts, 0, -1)) . '\Resource\\' . $alias;
500500
if (!class_exists($name)) {
501501
return $this->_resourceClass = $default;
502-
} else {
503-
return $this->_resourceClass = $name;
504502
}
503+
504+
return $this->_resourceClass = $name;
505505
}
506506

507507
return $this->_resourceClass;

tests/bootstrap.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,14 @@
8383
],
8484
]);
8585

86-
$config = [
86+
if (!getenv('DB_DSN')) {
87+
putenv('DB_DSN=sqlite:///:memory:');
88+
}
89+
90+
ConnectionManager::setConfig('test', [
8791
'className' => Connection::class,
8892
'driver' => TestDriver::class,
89-
];
90-
91-
// Use the test connection for 'debug_kit' as well.
92-
ConnectionManager::setConfig('test', $config);
93+
] + ConnectionManager::parseDsn(env('DB_DSN')));
9394

9495
Log::setConfig([
9596
'debug' => [

0 commit comments

Comments
 (0)