Skip to content

Commit c0e722e

Browse files
committed
Merge branch '4.next' into 4.x
2 parents 0240d18 + f4e3bab commit c0e722e

11 files changed

Lines changed: 109 additions & 182 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
php-version: ['7.2', '7.4', '8.0']
19+
php-version: ['7.2', '7.4', '8.0', '8.1']
2020
name: PHP ${{ matrix.php-version }}
2121

2222
steps:
@@ -26,17 +26,24 @@ jobs:
2626
uses: shivammathur/setup-php@v2
2727
with:
2828
php-version: ${{ matrix.php-version }}
29-
extensions: mbstring, intl, pdo_sqlite, pdo_mysql
29+
extensions: mbstring, intl, pdo_sqlite
3030
coverage: none
3131

3232
- name: Composer install
3333
run: |
34-
composer install
34+
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
35+
composer update --ignore-platform-reqs
36+
else
37+
composer update
38+
fi
3539
composer run-script post-install-cmd --no-interaction
3640
3741
- name: Run PHPUnit
3842
run: |
39-
vendor/bin/phpunit
43+
cp config/app_local.example.php config/app_local.php
44+
vendor/bin/phpunit
45+
env:
46+
DATABASE_TEST_URL: sqlite://./testdb.sqlite
4047

4148
coding-standard:
4249
name: Coding Standard

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
"license": "MIT",
77
"require": {
88
"php": ">=7.2",
9-
"cakephp/cakephp": "~4.2.0",
10-
"cakephp/migrations": "^3.0",
9+
"cakephp/cakephp": "dev-4.next as 4.3.0",
10+
"cakephp/migrations": "dev-3.next as 3.2.0",
1111
"cakephp/plugin-installer": "^1.3",
1212
"mobiledetect/mobiledetectlib": "^2.8"
1313
},
1414
"require-dev": {
1515
"cakephp/bake": "^2.3",
16-
"cakephp/cakephp-codesniffer": "~4.2.0",
17-
"cakephp/debug_kit": "^4.4",
16+
"cakephp/repl": "^0.1",
17+
"cakephp/cakephp-codesniffer": "^4.5",
18+
"cakephp/debug_kit": "dev-4.next as 4.5.0",
1819
"josegonzalez/dotenv": "^3.2",
19-
"phpunit/phpunit": "^8.5 || ^9.3",
20-
"psy/psysh": "@stable"
20+
"phpunit/phpunit": "~8.5.0 || ^9.3"
2121
},
2222
"suggest": {
2323
"markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.",

config/app_local.example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
'password' => 'secret',
7171
'database' => 'test_myapp',
7272
//'schema' => 'myapp',
73-
'url' => env('DATABASE_TEST_URL', null),
73+
'url' => env('DATABASE_TEST_URL', 'sqlite://127.0.0.1/tests.sqlite'),
7474
],
7575
],
7676

config/bootstrap.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@
167167

168168
/*
169169
* Setup detectors for mobile and tablet.
170+
* If you don't use these checks you can safely remove this code
171+
* and the mobiledetect package from composer.json.
170172
*/
171173
ServerRequest::addDetector('mobile', function ($request) {
172174
$detector = new \Detection\MobileDetect();
@@ -180,31 +182,27 @@
180182
});
181183

182184
/*
183-
* You can set whether the ORM uses immutable or mutable Time types.
184-
* The default changed in 4.0 to immutable types. You can uncomment
185-
* below to switch back to mutable types.
186-
*
187185
* You can enable default locale format parsing by adding calls
188186
* to `useLocaleParser()`. This enables the automatic conversion of
189187
* locale specific date formats. For details see
190188
* @link https://book.cakephp.org/4/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data
191189
*/
192190
// \Cake\Database\TypeFactory::build('time')
193-
// ->useMutable();
191+
// ->useLocaleParser();
194192
// \Cake\Database\TypeFactory::build('date')
195-
// ->useMutable();
193+
// ->useLocaleParser();
196194
// \Cake\Database\TypeFactory::build('datetime')
197-
// ->useMutable();
195+
// ->useLocaleParser();
198196
// \Cake\Database\TypeFactory::build('timestamp')
199-
// ->useMutable();
197+
// ->useLocaleParser();
200198
// \Cake\Database\TypeFactory::build('datetimefractional')
201-
// ->useMutable();
199+
// ->useLocaleParser();
202200
// \Cake\Database\TypeFactory::build('timestampfractional')
203-
// ->useMutable();
201+
// ->useLocaleParser();
204202
// \Cake\Database\TypeFactory::build('datetimetimezone')
205-
// ->useMutable();
203+
// ->useLocaleParser();
206204
// \Cake\Database\TypeFactory::build('timestamptimezone')
207-
// ->useMutable();
205+
// ->useLocaleParser();
208206

209207
// There is no time-specific type in Cake
210208
TypeFactory::map('time', StringType::class);

config/routes.php

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -24,67 +24,68 @@
2424
use Cake\Routing\Route\DashedRoute;
2525
use Cake\Routing\RouteBuilder;
2626

27-
/*
28-
* The default class to use for all routes
29-
*
30-
* The following route classes are supplied with CakePHP and are appropriate
31-
* to set as the default:
32-
*
33-
* - Route
34-
* - InflectedRoute
35-
* - DashedRoute
36-
*
37-
* If no call is made to `Router::defaultRouteClass()`, the class used is
38-
* `Route` (`Cake\Routing\Route\Route`)
39-
*
40-
* Note that `Route` does not do any inflections on URLs which will result in
41-
* inconsistently cased URLs when used with `:plugin`, `:controller` and
42-
* `:action` markers.
43-
*/
44-
/** @var \Cake\Routing\RouteBuilder $routes */
45-
$routes->setRouteClass(DashedRoute::class);
46-
47-
$routes->scope('/', function (RouteBuilder $builder) {
27+
return static function (RouteBuilder $routes) {
4828
/*
49-
* Here, we are connecting '/' (base path) to a controller called 'Pages',
50-
* its action called 'display', and we pass a param to select the view file
51-
* to use (in this case, templates/Pages/home.php)...
29+
* The default class to use for all routes
30+
*
31+
* The following route classes are supplied with CakePHP and are appropriate
32+
* to set as the default:
33+
*
34+
* - Route
35+
* - InflectedRoute
36+
* - DashedRoute
37+
*
38+
* If no call is made to `Router::defaultRouteClass()`, the class used is
39+
* `Route` (`Cake\Routing\Route\Route`)
40+
*
41+
* Note that `Route` does not do any inflections on URLs which will result in
42+
* inconsistently cased URLs when used with `:plugin`, `:controller` and
43+
* `:action` markers.
5244
*/
53-
$builder->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
45+
$routes->setRouteClass(DashedRoute::class);
5446

55-
/*
56-
* ...and connect the rest of 'Pages' controller's URLs.
57-
*/
58-
$builder->connect('/pages/*', 'Pages::display');
47+
$routes->scope('/', function (RouteBuilder $builder) {
48+
/*
49+
* Here, we are connecting '/' (base path) to a controller called 'Pages',
50+
* its action called 'display', and we pass a param to select the view file
51+
* to use (in this case, templates/Pages/home.php)...
52+
*/
53+
$builder->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
54+
55+
/*
56+
* ...and connect the rest of 'Pages' controller's URLs.
57+
*/
58+
$builder->connect('/pages/*', 'Pages::display');
59+
60+
/*
61+
* Connect catchall routes for all controllers.
62+
*
63+
* The `fallbacks` method is a shortcut for
64+
*
65+
* ```
66+
* $builder->connect('/:controller', ['action' => 'index']);
67+
* $builder->connect('/:controller/:action/*', []);
68+
* ```
69+
*
70+
* You can remove these routes once you've connected the
71+
* routes you want in your application.
72+
*/
73+
$builder->fallbacks();
74+
});
5975

6076
/*
61-
* Connect catchall routes for all controllers.
77+
* If you need a different set of middleware or none at all,
78+
* open new scope and define routes there.
6279
*
63-
* The `fallbacks` method is a shortcut for
64-
*
65-
* ```
66-
* $builder->connect('/{controller}', ['action' => 'index']);
67-
* $builder->connect('/{controller}/{action}/*', []);
6880
* ```
81+
* $routes->scope('/api', function (RouteBuilder $builder) {
82+
* // No $builder->applyMiddleware() here.
6983
*
70-
* You can remove these routes once you've connected the
71-
* routes you want in your application.
84+
* // Parse specified extensions from URLs
85+
* // $builder->setExtensions(['json', 'xml']);
86+
*
87+
* // Connect API actions here.
88+
* });
89+
* ```
7290
*/
73-
$builder->fallbacks();
74-
});
75-
76-
/*
77-
* If you need a different set of middleware or none at all,
78-
* open new scope and define routes there.
79-
*
80-
* ```
81-
* $routes->scope('/api', function (RouteBuilder $builder) {
82-
* // No $builder->applyMiddleware() here.
83-
*
84-
* // Parse specified extensions from URLs
85-
* // $builder->setExtensions(['json', 'xml']);
86-
*
87-
* // Connect API actions here.
88-
* });
89-
* ```
90-
*/
91+
};

phpunit.xml.dist

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@
1818
<!-- Add plugin test suites here. -->
1919
</testsuites>
2020

21-
<!-- Setup a listener for fixtures -->
22-
<listeners>
23-
<listener class="Cake\TestSuite\Fixture\FixtureInjector">
24-
<arguments>
25-
<object class="Cake\TestSuite\Fixture\FixtureManager"/>
26-
</arguments>
27-
</listener>
28-
</listeners>
21+
<!-- Load extension for fixtures -->
22+
<extensions>
23+
<extension class="Cake\TestSuite\Fixture\PHPUnitExtension"/>
24+
</extensions>
2925

3026
<!-- Ignore vendor tests in code coverage reports -->
3127
<filter>

src/Application.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
use Cake\Core\Configure;
2020
use Cake\Core\ContainerInterface;
21-
use Cake\Core\Exception\MissingPluginException;
2221
use Cake\Datasource\FactoryLocator;
2322
use Cake\Error\Middleware\ErrorHandlerMiddleware;
2423
use Cake\Http\BaseApplication;
@@ -127,11 +126,8 @@ public function services(ContainerInterface $container): void
127126
*/
128127
protected function bootstrapCli(): void
129128
{
130-
try {
131-
$this->addPlugin('Bake');
132-
} catch (MissingPluginException $e) {
133-
// Do not halt if the plugin is missing
134-
}
129+
$this->addOptionalPlugin('Cake/Repl');
130+
$this->addOptionalPlugin('Bake');
135131

136132
$this->addPlugin('Migrations');
137133

src/Command/ConsoleCommand.php

Lines changed: 0 additions & 89 deletions
This file was deleted.

tests/TestCase/ApplicationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public function testBootstrap()
4040
$app->bootstrap();
4141
$plugins = $app->getPlugins();
4242

43-
$this->assertCount(3, $plugins);
43+
$this->assertCount(4, $plugins);
44+
$this->assertSame('Cake/Repl', $plugins->get('Cake/Repl')->getName());
4445
$this->assertSame('Bake', $plugins->get('Bake')->getName());
4546
$this->assertSame('DebugKit', $plugins->get('DebugKit')->getName());
4647
$this->assertSame('Migrations', $plugins->get('Migrations')->getName());

0 commit comments

Comments
 (0)