Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ trim_trailing_whitespace = true
[*.bat]
end_of_line = crlf

[templates/bake/layout/*.yml]
insert_final_newline = false

[*.yml]
indent_style = space
indent_size = 2

[*.twig]
insert_final_newline = false
10 changes: 5 additions & 5 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ on:

jobs:
cs:
uses: bedita/github-workflows/.github/workflows/php-cs.yml@v1
uses: bedita/github-workflows/.github/workflows/php-cs.yml@v2
with:
php_versions: '["7.4", "8.1", "8.2"]'
php_versions: '["8.3"]'

stan:
uses: bedita/github-workflows/.github/workflows/php-stan.yml@v1
uses: bedita/github-workflows/.github/workflows/php-stan.yml@v2
with:
php_versions: '["7.4", "8.1", "8.2"]'
php_versions: '["8.3"]'

unit:
name: 'Run unit tests'
Expand All @@ -30,7 +30,7 @@ jobs:

strategy:
matrix:
php-version: [7.4, 8.1, 8.2]
php-version: [8.1, 8.2, 8.3]

steps:
- name: 'Checkout current revision'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ phinx.yml
/phpstan.neon
/phpunit.xml
.phpunit.result.cache
.phpunit.cache
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bedita/dev-tools",
"type": "cakephp-plugin",
"description": "A plugin to give some useful tools to BEdita developers.",
"keywords": ["cakephp", "cake3", "plugin", "bedita", "debug_kit", "travis", "scrutinizer"],
"keywords": ["cakephp", "cake5", "plugin", "bedita", "debug_kit", "scrutinizer"],
"license": "LGPL-3.0-or-later",
"support": {
"source": "https://github.com/bedita/dev-tools",
Expand All @@ -21,17 +21,17 @@
}
],
"require": {
"php": ">=7.4",
"php": ">=8.1",
"ext-json": "*",
"cakephp/cakephp": "^4.3.0",
"cakephp/debug_kit": "^4.7"
"cakephp/cakephp": "^5.1.0",
"cakephp/debug_kit": "^5.0.0"
},
"require-dev": {
"cakephp/bake": "^2.6",
"cakephp/migrations": "^3.4.0",
"cakephp/cakephp-codesniffer": "~4.5.1",
"cakephp/bake": "^3.0.0",
"cakephp/migrations": "^4.0.0",
"cakephp/cakephp-codesniffer": "^5.0",
"phpstan/phpstan": "^1.5",
"phpunit/phpunit": "^9.0"
"phpunit/phpunit": "^10.1.0"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

<rule ref="CakePHP"/>

<exclude-pattern>/tests/comparisons/*</exclude-pattern>
</ruleset>
8 changes: 6 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
parameters:
phpVersion: 70400 # PHP 7.4
bootstrapFiles:
- tests/bootstrap.php
paths:
- src
- tests
level: 9
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
excludePaths:
- tests/comparisons/*
65 changes: 29 additions & 36 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ BEdita, API-first content management framework
~ Copyright 2017 ChannelWeb Srl, Chialab Srl
~
~ This file is part of BEdita: you can redistribute it and/or modify
~ it under the terms of the GNU Lesser General Public License as published
~ by the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ See LICENSE.LGPL or <http://gnu.org/licenses/lgpl-3.0.html> for more details.
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="./tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src/</directory>
</include>
</coverage>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>
<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="BEdita 4 Dev Tools Test Suite">
<directory>./tests/TestCase</directory>
</testsuite>
</testsuites>
<!-- Setup a listener for fixtures -->
<listeners>
<listener class="\Cake\TestSuite\Fixture\FixtureInjector" file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
<arguments>
<object class="\Cake\TestSuite\Fixture\FixtureManager"/>
</arguments>
</listener>
</listeners>
<!-- Ignore vendor tests in code coverage reports -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="./tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
requireCoverageMetadata="true"
>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>

<testsuites>
<testsuite name="BEdita 4 Dev Tools Test Suite">
<directory>./tests/TestCase</directory>
</testsuite>
</testsuites>

<extensions>
<bootstrap class="Cake\TestSuite\Fixture\Extension\PHPUnitExtension"/>
</extensions>

<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
4 changes: 2 additions & 2 deletions src/Command/ChangeLogCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ChangeLogCommand extends Command
*
* @var array
*/
protected $_defaultConfig = [
protected array $_defaultConfig = [
// Classification filter on labels
'filter' => [
'integration' => [
Expand Down Expand Up @@ -97,7 +97,7 @@ public function initialize(): void
*
* @param \Cake\Console\Arguments $args The command arguments.
* @param \Cake\Console\ConsoleIo $io The console io
* @return null|int The exit code or null for success
* @return int|null The exit code or null for success
*/
public function execute(Arguments $args, ConsoleIo $io): ?int
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/**
* BEdita, API-first content management framework
* Copyright 2017-2022 ChannelWeb Srl, Chialab Srl
* Copyright 2024 ChannelWeb Srl, Chialab Srl
*
* This file is part of BEdita: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
Expand All @@ -12,24 +12,25 @@
*
* See LICENSE.LGPL or <http://gnu.org/licenses/lgpl-3.0.html> for more details.
*/
namespace BEdita\DevTools\Shell\Task;
namespace BEdita\DevTools\Command;

use Bake\Utility\TemplateRenderer;
use Migrations\Shell\Task\SimpleMigrationTask;
use Cake\Console\Arguments;
use Cake\Console\ConsoleIo;
use Migrations\Command\BakeSimpleMigrationCommand;

/**
* {@inheritDoc}
*
* Task class for generating resources migrations files.
* Command class for generating resources migrations files.
*/
class ResourcesMigrationTask extends SimpleMigrationTask
class ResourcesMigrationCommand extends BakeSimpleMigrationCommand
{
/**
* Main migration file name.
*
* @var string|null
*/
protected $migrationFile = null;
protected ?string $migrationFile = null;

/**
* @inheritDoc
Expand Down Expand Up @@ -62,19 +63,17 @@ public function template(): string
/**
* @inheritDoc
*/
public function bake($name): string
public function bake(string $name, Arguments $args, ConsoleIo $io): void
{
// create .php file first, then .yml
parent::bake($name);
parent::bake($name, $args, $io);

$renderer = new TemplateRenderer($this->theme);
$renderer->set('name', $name);
$renderer->set($this->templateData());
$contents = $renderer->generate('BEdita/DevTools.yaml');
$contents = $this->createTemplateRenderer()
->set('name', $name)
->set($this->templateData($args))
->generate('BEdita/DevTools.yaml');

$filename = $this->getPath() . str_replace('.php', '.yml', $this->fileName($name));
$this->createFile($filename, $contents);

return $contents;
$filename = $this->getPath($args) . str_replace('.php', '.yml', $this->fileName($name));
$io->createFile($filename, $contents, $this->force);
}
}
2 changes: 1 addition & 1 deletion src/Panel/ConfigurationPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ConfigurationPanel extends DebugPanel
*
* @var string
*/
public $plugin = 'BEdita/DevTools';
public string $plugin = 'BEdita/DevTools';

/**
* Collect configuration data when panel is initialized.
Expand Down
4 changes: 2 additions & 2 deletions templates/Common/html.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/* @var \Psr\Http\Message\ServerRequestInterface $request */
/* @var \Psr\Http\Message\ResponseInterface $response */
/** @var \Psr\Http\Message\ServerRequestInterface $request */
/** @var \Psr\Http\Message\ResponseInterface $response */
$this->assign('title', __('BEdita 4 - API Response'));

$this->Html->css('BEdita/DevTools.jquery.jsonview', ['block' => true]);
Expand Down
2 changes: 1 addition & 1 deletion templates/bake/resources.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ use BEdita\Core\Migration\ResourcesMigration;

class {{ name }} extends ResourcesMigration
{
}
}
2 changes: 1 addition & 1 deletion templates/bake/yaml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

#update:

#remove:
#remove:
3 changes: 1 addition & 2 deletions tests/TestCase/Command/ChangeLogCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class ChangeLogCommandTest extends TestCase
public function setUp(): void
{
parent::setUp();
$this->useCommandRunner();
Router::reload();
}

Expand Down Expand Up @@ -117,7 +116,7 @@ public function testExecute(): void
->getMock();
$mock->expects($this->once())
->method('send')
->will($this->returnValue([$response]));
->willReturn([$response]);

$current = (array)Configure::read('ChangeLog');
Configure::write('ChangeLog', [
Expand Down
Loading
Loading