Skip to content

Commit d0fe833

Browse files
committed
Merge branch '3.next'
2 parents 4fbe94d + 26d2d01 commit d0fe833

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+325
-136
lines changed

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
},
2525
"require": {
2626
"php": ">=5.6.0",
27-
"cakephp/cakephp": "^3.4.0",
27+
"cakephp/cakephp": "dev-3.next as 3.6.0",
2828
"cakephp/chronos": "^1.0.0",
2929
"cakephp/plugin-installer": "^1.0.0",
3030
"composer/composer": "^1.3.0",
3131
"jdorn/sql-formatter": "^1.2.0"
3232
},
3333
"require-dev": {
3434
"cakephp/cakephp-codesniffer": "^3.0",
35-
"phpunit/phpunit": "^5.7|^6.0"
35+
"phpunit/phpunit": "^5.7.14|^6.0"
3636
},
3737
"autoload": {
3838
"psr-4": {
@@ -42,8 +42,9 @@
4242
},
4343
"autoload-dev": {
4444
"psr-4": {
45-
"Cake\\Test\\": "vendor/cakephp/cakephp/tests",
46-
"DebugKit\\Test\\": "tests"
45+
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/",
46+
"DebugKit\\Test\\": "tests/",
47+
"DebugKit\\TestApp\\": "tests/test_app/"
4748
}
4849
},
4950
"suggest": {

config/bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
return;
2929
}
3030

31-
$hasDebugKitConfig = ConnectionManager::config('debug_kit');
31+
$hasDebugKitConfig = ConnectionManager::getConfig('debug_kit');
3232
if (!$hasDebugKitConfig && !in_array('sqlite', PDO::getAvailableDrivers())) {
3333
$msg = 'DebugKit not enabled. You need to either install pdo_sqlite, ' .
3434
'or define the "debug_kit" connection name.';
@@ -37,7 +37,7 @@
3737
}
3838

3939
if (!$hasDebugKitConfig) {
40-
ConnectionManager::config('debug_kit', [
40+
ConnectionManager::setConfig('debug_kit', [
4141
'className' => 'Cake\Database\Connection',
4242
'driver' => 'Cake\Database\Driver\Sqlite',
4343
'database' => TMP . 'debug_kit.sqlite',

config/routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use Cake\Routing\Router;
44

55
Router::plugin('DebugKit', ['path' => '/debug-kit'], function (RouteBuilder $routes) {
6-
$routes->extensions('json');
6+
$routes->setExtensions('json');
77
$routes->connect(
88
'/toolbar/clear-cache',
99
['controller' => 'Toolbar', 'action' => 'clearCache']

src/Cache/Engine/DebugEngine.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ public function groups()
249249
* This method uses func_get_args() as not doing so confuses the
250250
* proxied class.
251251
*
252+
* @deprecated 3.6.0 use setConfig()/getConfig() instead.
252253
* @param string $key The key to set/read.
253254
* @param mixed $value The value to set.
254255
* @param bool $merge Whether or not configuration should be merged.
@@ -259,6 +260,32 @@ public function config($key = null, $value = null, $merge = true)
259260
return call_user_func_array([$this->_engine, 'config'], func_get_args());
260261
}
261262

263+
/**
264+
* Returns the config.
265+
*
266+
* @param string|null $key The key to get or null for the whole config.
267+
* @param mixed $default The return value when the key does not exist.
268+
* @return mixed Config value being read.
269+
*/
270+
public function getConfig($key = null, $default = null)
271+
{
272+
return $this->_engine->getConfig($key, $default);
273+
}
274+
275+
/**
276+
* Sets the config.
277+
*
278+
* @param string|array $key The key to set, or a complete array of configs.
279+
* @param mixed|null $value The value to set.
280+
* @param bool $merge Whether to recursively merge or overwrite existing config, defaults to true.
281+
* @return $this
282+
* @throws \Cake\Core\Exception\Exception When trying to set a key that is invalid.
283+
*/
284+
public function setConfig($key, $value = null, $merge = true)
285+
{
286+
return $this->_engine->setConfig($key, $value, $merge);
287+
}
288+
262289
/**
263290
* {@inheritDoc}
264291
*/

src/Controller/ComposerController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Cake\Controller\Controller;
1717
use Cake\Core\Configure;
1818
use Cake\Event\Event;
19-
use Cake\Network\Exception\NotFoundException;
19+
use Cake\Http\Exception\NotFoundException;
2020
use Cake\View\JsonView;
2121
use Composer\Console\Application;
2222
use Symfony\Component\Console\Input\ArrayInput;
@@ -43,7 +43,7 @@ public function initialize()
4343
*
4444
* @param \Cake\Event\Event $event The event.
4545
* @return void
46-
* @throws \Cake\Network\Exception\NotFoundException
46+
* @throws \Cake\Http\Exception\NotFoundException
4747
*/
4848
public function beforeFilter(Event $event)
4949
{

src/Controller/MailPreviewController.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Cake\Core\Configure;
2020
use Cake\Core\Plugin;
2121
use Cake\Event\Event;
22-
use Cake\Network\Exception\NotFoundException;
22+
use Cake\Http\Exception\NotFoundException;
2323
use Cake\Utility\Inflector;
2424
use DebugKit\Mailer\AbstractResult;
2525
use DebugKit\Mailer\PreviewResult;
@@ -39,7 +39,7 @@ class MailPreviewController extends Controller
3939
*
4040
* @param \Cake\Event\Event $event The beforeFilter event.
4141
* @return void
42-
* @throws \Cake\Network\Exception\NotFoundException
42+
* @throws \Cake\Http\Exception\NotFoundException
4343
*/
4444
public function beforeFilter(Event $event)
4545
{
@@ -93,15 +93,15 @@ public function sent($panelId, $number)
9393
$email = $content['emails'][$number];
9494
$email = new SentMailResult(array_filter($email['headers']), $email['message']);
9595

96-
$partType = $this->request->query('part');
96+
$partType = $this->request->getQuery('part');
9797
if ($partType) {
9898
return $this->respondWithPart($email, $partType);
9999
}
100100

101101
$this->set('noHeader', true);
102102
$this->set('email', $email);
103103
$this->set('plugin', '');
104-
$this->set('part', $this->findPreferredPart($email, $this->request->query('part')));
104+
$this->set('part', $this->findPreferredPart($email, $this->request->getQuery('part')));
105105
$this->viewBuilder()->template('email');
106106
}
107107

@@ -114,9 +114,9 @@ public function sent($panelId, $number)
114114
*/
115115
public function email($name, $method)
116116
{
117-
$plugin = $this->request->query('plugin');
117+
$plugin = $this->request->getQuery('plugin');
118118
$email = $this->findPreview($name, $method, $plugin);
119-
$partType = $this->request->query('part');
119+
$partType = $this->request->getQuery('part');
120120

121121
$this->viewBuilder()->layout(false);
122122

@@ -128,7 +128,7 @@ public function email($name, $method)
128128
$this->set('title', $humanName);
129129
$this->set('email', $email);
130130
$this->set('plugin', $plugin);
131-
$this->set('part', $this->findPreferredPart($email, $this->request->query('part')));
131+
$this->set('part', $this->findPreferredPart($email, $this->request->getQuery('part')));
132132
}
133133

134134
/**
@@ -147,13 +147,13 @@ protected function respondWithPart($email, $partType)
147147
throw new NotFoundException(__d('debug_kit', "Email part '{0}' not found in email", $partType));
148148
}
149149

150-
$this->response->type($partType);
150+
$response = $this->response->withType($partType);
151151
if ($part === 'text') {
152152
$part = '<pre>' . $part . "</pre>";
153153
}
154-
$this->response->body($part);
154+
$response = $response->withStringBody($part);
155155

156-
return $this->response;
156+
return $response;
157157
}
158158

159159
/**
@@ -251,7 +251,7 @@ protected function findPreferredPart(AbstractResult $email, $partType)
251251
* @param string $emailName The mailer preview method
252252
* @param string|null $plugin The plugin where the mailer preview should be found
253253
* @return \DebugKit\Mailer\PreviewResult The result of the email preview
254-
* @throws \Cake\Network\Exception\NotFoundException
254+
* @throws \Cake\Http\Exception\NotFoundException
255255
*/
256256
protected function findPreview($previewName, $emailName, $plugin = null)
257257
{

src/Controller/PanelsController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Cake\Controller\Controller;
1616
use Cake\Core\Configure;
1717
use Cake\Event\Event;
18-
use Cake\Network\Exception\NotFoundException;
18+
use Cake\Http\Exception\NotFoundException;
1919

2020
/**
2121
* Provides access to panel data.
@@ -37,7 +37,7 @@ class PanelsController extends Controller
3737
*
3838
* @param \Cake\Event\Event $event The event.
3939
* @return void
40-
* @throws \Cake\Network\Exception\NotFoundException
40+
* @throws \Cake\Http\Exception\NotFoundException
4141
*/
4242
public function beforeFilter(Event $event)
4343
{
@@ -67,7 +67,7 @@ public function beforeRender(Event $event)
6767
*
6868
* @param string $requestId Request id
6969
* @return void
70-
* @throws \Cake\Network\Exception\NotFoundException
70+
* @throws \Cake\Http\Exception\NotFoundException
7171
*/
7272
public function index($requestId = null)
7373
{

src/Controller/RequestsController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Cake\Controller\Controller;
1616
use Cake\Core\Configure;
1717
use Cake\Event\Event;
18-
use Cake\Network\Exception\NotFoundException;
18+
use Cake\Http\Exception\NotFoundException;
1919

2020
/**
2121
* Provides access to panel data.
@@ -30,7 +30,7 @@ class RequestsController extends Controller
3030
*
3131
* @param \Cake\Event\Event $event The event.
3232
* @return void
33-
* @throws \Cake\Network\Exception\NotFoundException
33+
* @throws \Cake\Http\Exception\NotFoundException
3434
*/
3535
public function beforeFilter(Event $event)
3636
{
@@ -39,7 +39,7 @@ public function beforeFilter(Event $event)
3939
throw new NotFoundException();
4040
}
4141

42-
$this->response->header(['Content-Security-Policy' => '']);
42+
$this->response = $this->response->withHeader('Content-Security-Policy', '');
4343
}
4444

4545
/**

src/Controller/ToolbarController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Cake\Controller\Controller;
1717
use Cake\Core\Configure;
1818
use Cake\Event\Event;
19-
use Cake\Network\Exception\NotFoundException;
19+
use Cake\Http\Exception\NotFoundException;
2020

2121
/**
2222
* Provides utility features need by the toolbar.
@@ -43,7 +43,7 @@ class ToolbarController extends Controller
4343
*
4444
* @param \Cake\Event\Event $event The event.
4545
* @return void
46-
* @throws \Cake\Network\Exception\NotFoundException
46+
* @throws \Cake\Http\Exception\NotFoundException
4747
*/
4848
public function beforeFilter(Event $event)
4949
{
@@ -57,15 +57,15 @@ public function beforeFilter(Event $event)
5757
* Clear a named cache.
5858
*
5959
* @return void
60-
* @throws \Cake\Network\Exception\NotFoundException
60+
* @throws \Cake\Http\Exception\NotFoundException
6161
*/
6262
public function clearCache()
6363
{
6464
$this->request->allowMethod('post');
65-
if (!$this->request->data('name')) {
65+
if (!$this->request->getData('name')) {
6666
throw new NotFoundException(__d('debug_kit', 'Invalid cache engine name.'));
6767
}
68-
$result = Cache::clear(false, $this->request->data('name'));
68+
$result = Cache::clear(false, $this->request->getData('name'));
6969
$this->set([
7070
'_serialize' => ['success'],
7171
'success' => $result,

src/Model/Behavior/TimedBehavior.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TimedBehavior extends Behavior
3232
*/
3333
public function beforeFind(Event $event, $query)
3434
{
35-
$alias = $event->subject()->alias();
35+
$alias = $event->getSubject()->getAlias();
3636
DebugTimer::start($alias . '_find', $alias . '->find()');
3737

3838
return $query->formatResults(function ($results) use ($alias) {
@@ -50,7 +50,7 @@ public function beforeFind(Event $event, $query)
5050
*/
5151
public function beforeSave(Event $event)
5252
{
53-
$alias = $event->subject()->alias();
53+
$alias = $event->getSubject()->getAlias();
5454
DebugTimer::start($alias . '_save', $alias . '->save()');
5555
}
5656

@@ -62,7 +62,7 @@ public function beforeSave(Event $event)
6262
*/
6363
public function afterSave(Event $event)
6464
{
65-
$alias = $event->subject()->alias();
65+
$alias = $event->getSubject()->getAlias();
6666
DebugTimer::stop($alias . '_save');
6767
}
6868
}

0 commit comments

Comments
 (0)