Skip to content

Commit

Permalink
Merge branch '4.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 16, 2019
2 parents dce20bd + 3f06936 commit 2419516
Show file tree
Hide file tree
Showing 137 changed files with 781 additions and 1,212 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ nbproject/*
.svn
errors.err
tags
/.phpunit.result.cache
/nbproject/
/composer.lock
/vendor
Expand Down
32 changes: 10 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
language: php

php:
- 5.6
- 7.0
- 7.2
- 7.3
- 7.4snapshot

dist: xenial

services:
- postgresql
- mysql
Expand All @@ -20,36 +21,23 @@ env:

matrix:
fast_finish: true
include:
- php: 7.1
env: PHPCS=1

- php: 7.1
env: CODECOVERAGE=1 DEFAULT=0

- php: 5.6
env: PREFER_LOWEST=1

allow_failures:
- php: 7.4snapshot

install:
- sh -c "if [ '$PREFER_LOWEST' != '1' ]; then composer install --prefer-dist --no-interaction; fi"
- sh -c "if [ '$PREFER_LOWEST' = '1' ]; then composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi"
- composer install --prefer-dist --no-interaction

before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi"
- if [ $DB = 'mysql' ]; then mysql -u root -e 'CREATE DATABASE cakephp_test;'; fi
- if [ $DB = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi

script:
- sh -c "if [ '$DEFAULT' = '1' ]; then [ "$(find . \( -path './vendor' \) -prune -o -type f \( -name '*.ctp' -o -name '*.php' \) -print0 | xargs -0 --no-run-if-empty -L1 -i'{}' php -l '{}' | grep -vc 'No syntax errors')" -eq 0 ]; fi"
- sh -c "if [ '$DEFAULT' = '1' ]; then ./vendor/bin/phpunit; fi"

- sh -c "if [ '$PHPCS' = '1' ]; then ./vendor/bin/phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi"
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.1 ]]; then vendor/bin/phpunit --coverage-clover=clover.xml; fi
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION != 7.1 ]]; then vendor/bin/phpunit; fi

- sh -c "if [ '$CODECOVERAGE' = '1' ]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=clover.xml || true; fi"
- sh -c "if [ '$CODECOVERAGE' = '1' ]; then wget -O codecov.sh https://codecov.io/bash; fi"
- sh -c "if [ '$CODECOVERAGE' = '1' ]; then bash codecov.sh; fi"
after_success:
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.1 ]]; then bash <(curl -s https://codecov.io/bash); fi

notifications:
email: false
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ php composer.phar require --dev cakephp/debug_kit:"~3.0"
// src/Application.php
$this->addPlugin('DebugKit');
```
Prior to 3.6.0
```php
Plugin::load('DebugKit', ['bootstrap' => true, 'routes' => true]);
```
* Set `'debug' => true,` in `config/app.php`.

## Reporting Issues
Expand Down
26 changes: 10 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
"source": "https://github.com/cakephp/debug_kit"
},
"require": {
"php": ">=5.6.0",
"cakephp/cakephp": "^3.7.0",
"cakephp/chronos": "^1.0.0",
"cakephp/plugin-installer": "^1.0.0",
"composer/composer": "^1.3.0",
"jdorn/sql-formatter": "^1.2.0"
"php": ">=7.2",
"cakephp/cakephp": "4.x-dev as 4.0.0",
"cakephp/chronos": "2.x-dev as 2.0.0",
"cakephp/plugin-installer": "^1.0",
"composer/composer": "^1.3",
"jdorn/sql-formatter": "^1.2"
},
"require-dev": {
"cakephp/cakephp-codesniffer": "^3.0",
"phpunit/phpunit": "^5.7.14|^6.0"
"cakephp/cakephp-codesniffer": "dev-next",
"phpunit/phpunit": "^8.0"
},
"autoload": {
"psr-4": {
Expand All @@ -51,12 +51,6 @@
"suggest": {
"ext-pdo_sqlite": "DebugKit needs to store panel data in a database. SQLite is simple and easy to use."
},
"scripts": {
"check": [
"@cs-check",
"@test"
],
"cs-check": "phpcs --colors -p src/ tests/",
"cs-fix": "phpcbf --colors -p src/ tests/"
}
"prefer-stable": true,
"minimum-stability": "dev"
}
48 changes: 0 additions & 48 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,10 @@
* @link http://cakephp.org CakePHP(tm) Project
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Configure;
use Cake\Core\Plugin as CorePlugin;
use Cake\Database\Query;
use Cake\Datasource\ConnectionManager;
use Cake\Event\EventManager;
use Cake\Log\Log;
use Cake\Routing\DispatcherFactory;
use DebugKit\DebugSql;
use DebugKit\Middleware\DebugKitMiddleware;
use DebugKit\Panel\DeprecationsPanel;
use DebugKit\Routing\Filter\DebugBarFilter;
use DebugKit\ToolbarService;

$service = new ToolbarService(EventManager::instance(), (array)Configure::read('DebugKit'));

if (!$service->isEnabled() || php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg') {
return;
}

if (!empty($service->getConfig('panels')['DebugKit.Deprecations'])) {
$errorLevel = Configure::read('Error.errorLevel', E_ALL | E_STRICT);
$previousHandler = set_error_handler(
function ($code, $message, $file, $line, $context = null) use (&$previousHandler) {
if ($code == E_USER_DEPRECATED || $code == E_DEPRECATED) {
DeprecationsPanel::addDeprecatedError(compact('code', 'message', 'file', 'line', 'context'));

return;
}
if ($previousHandler) {
return $previousHandler($code, $message, $file, $line, $context);
}
},
$errorLevel | E_USER_DEPRECATED | E_DEPRECATED
);
}

$hasDebugKitConfig = ConnectionManager::getConfig('debug_kit');
if (!$hasDebugKitConfig && !in_array('sqlite', PDO::getAvailableDrivers())) {
Expand All @@ -66,23 +35,6 @@ function ($code, $message, $file, $line, $context = null) use (&$previousHandler
]);
}

if (!CorePlugin::getCollection()->get('DebugKit')->isEnabled('routes')) {
include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'routes.php';
}

$appClass = Configure::read('App.namespace') . '\Application';
if (class_exists($appClass)) {
EventManager::instance()->on('Server.buildMiddleware', function ($event, $queue) use ($service) {
$middleware = new DebugKitMiddleware($service);
$queue->insertAt(0, $middleware);
});
} else {
// Setup dispatch filter
$debugBar = new DebugBarFilter(EventManager::instance(), (array)Configure::read('DebugKit'));
$debugBar->setup();
DispatcherFactory::add($debugBar);
}

if (!function_exists('sql')) {
/**
* Prints out the SQL statements generated by a Query object.
Expand Down
2 changes: 1 addition & 1 deletion config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function (RouteBuilder $routes) {
$routes->connect('/', ['action' => 'index']);
$routes->connect('/preview', ['action' => 'email']);
$routes->connect('/preview/*', ['action' => 'email']);
$routes->connect('/sent/:panel/:id', ['action' => 'sent'], ['pass' => ['panel', 'id']]);
$routes->connect('/sent/{panel}/{id}', ['action' => 'sent'], ['pass' => ['panel', 'id']]);
}
);

Expand Down
14 changes: 8 additions & 6 deletions docs/config/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#

# The full version, including alpha/beta/rc tags.
release = '3.x'
release = '4.x'

# The search index version.
search_version = 'debugkit-3'
search_version = 'debugkit-4'

# The marketing display name for the book.
version_name = ''
Expand All @@ -23,19 +23,19 @@

# Other versions that display in the version picker menu.
version_list = [
{'name': '3.x', 'number': '/debugkit/3.x', 'title': '3.x', 'current': True},
# {'name': '4.x', 'number': '/debugkit/4.x', 'title': '4.x'},
{'name': '3.x', 'number': 'debugkit/3.x', 'title': '3.x'},
{'name': '4.x', 'number': 'debugkit/4.x', 'title': '4.x', 'current': True},
]

# Languages available.
languages = ['en', 'fr', 'ja', 'pt']

# The GitHub branch name for this version of the docs
# for edit links to point at.
branch = 'master'
branch = '4.x'

# Current version being built
version = '3.x'
version = '4.x'

# Language in use for this directory.
language = 'en'
Expand All @@ -50,3 +50,5 @@

# DebugKit docs use mp4 videos to show the UI
extensions.append('sphinxcontrib.video')

is_prerelease = True
2 changes: 1 addition & 1 deletion docs/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ you've removed it and want to re-install it, you can do so by running the
following from your application's ROOT directory (where composer.json file is
located)::

php composer.phar require --dev cakephp/debug_kit "~3.0"
php composer.phar require --dev cakephp/debug_kit "~4.0"

Then, you need to enable the plugin by executing the following line::

Expand Down
2 changes: 1 addition & 1 deletion docs/fr/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ le retirez et voulez le réinstaller, vous pouvez le faire en lançant ce qui
suit à partir du répertoire ROOT de votre application (où le fichier
composer.json est localisé)::

php composer.phar require --dev cakephp/debug_kit "~3.0"
php composer.phar require --dev cakephp/debug_kit "~4.0"

Ensuite, vous devez activer le plugin en exécutant la ligne suivante::

Expand Down
2 changes: 1 addition & 1 deletion docs/ja/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DebugKit は、CakePHP アプリケーション用のデバッグツールバー
もし削除してしまって再インストールしたい場合は、以下のコマンドをアプリケーションの
ルートディレクトリー (composer.json ファイルのある場所) で実行してください。 ::

php composer.phar require --dev cakephp/debug_kit "~3.0"
php composer.phar require --dev cakephp/debug_kit "~4.0"

そして以下のコマンドでプラグインを有効化する必要があります。 ::

Expand Down
2 changes: 1 addition & 1 deletion docs/pt/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ você o removeu e gostaria de reinstalá-lo, você pode executar o seguinte coma
a partir do diretório raiz da aplicação
(onde o arquivo composer.json está localizado)::

php composer.phar require --dev cakephp/debug_kit "~3.0"
php composer.phar require --dev cakephp/debug_kit "~4.0"

Então, você precisará habilitar o plugin ao executar o seguinte comando::

Expand Down
12 changes: 3 additions & 9 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<?xml version="1.0"?>
<ruleset name="CakePHP Core">
<rule ref="./vendor/cakephp/cakephp-codesniffer/CakePHP/ruleset.xml">
<!-- Exclude unwanted sniffs -->
<exclude name="Generic.Commenting.Todo.TaskFound"/> <!-- Excluded during 3.next development -->
</rule>
<ruleset name="CakePHP DebugKit">
<config name="installed_paths" value="../../cakephp/cakephp-codesniffer" />

<!-- Necessary for class aliases used for backwards compat -->
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
<severity>0</severity>
</rule>
<rule ref="CakePHP" />
</ruleset>
11 changes: 7 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/bootstrap.php">
<php>
<ini name="memory_limit" value="-1"/>
</php>
<phpunit
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="./tests/bootstrap.php"
>

<!-- Add any additional test suites you want to run here -->
<testsuites>
Expand All @@ -29,6 +31,7 @@
</listeners>

<php>
<ini name="memory_limit" value="-1"/>
<!-- Postgres
<env name="db_dsn" value="postgres://root@localhost/cake_test_db"/>
-->
Expand Down
Loading

0 comments on commit 2419516

Please sign in to comment.