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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
uses: bedita/github-workflows/.github/workflows/release.yml@v2
with:
main_branch: 'master'
dist_branches: '["master","1.x"]'
dist_branches: '["master", "1.x"]'
24 changes: 14 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@
"require": {
"php": ">=8.3",
"ext-json": "*",
"cakephp/cakephp": "^5.1.0",
"cakephp/debug_kit": "^5.0.0"
"cakephp/cakephp": "~5.2.9",
"cakephp/debug_kit": "^5.3.0"
},
"require-dev": {
"cakephp/bake": "^3.0.0",
"cakephp/migrations": "^4.0.0",
"cakephp/bake": "^3.5.0",
"cakephp/migrations": "^4.8",
"cakephp/cakephp-codesniffer": "^5.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.1.0"
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpunit/phpunit": "^11.5 || ^12.1"
},
"autoload": {
"psr-4": {
Expand All @@ -44,22 +46,24 @@
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
}
},
"minimum-stability": "stable",
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"check": [
"@test",
"@cs-check"
],
"cs-check": "vendor/bin/phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests",
"cs-fix": "vendor/bin/phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests",
"stan": "vendor/bin/phpstan analyse",
"cs-check": "vendor/bin/phpcs",
"cs-fix": "vendor/bin/phpcbf",
"test": "vendor/bin/phpunit --colors=always"
"test": "vendor/bin/phpunit --colors=always",
"coverage": "vendor/bin/phpunit --colors=always --coverage-html coverage"
},
"config": {
"allow-plugins": {
"cakephp/plugin-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
}
}
}
6 changes: 3 additions & 3 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<file>tests</file>

<arg name="colors"/>
<arg value="n" />
<arg value="p" />
<arg name="extensions" value="php"/>

<config name="installed_paths" value="../../cakephp/cakephp-codesniffer"/>

<rule ref="CakePHP"/>

<exclude-pattern>/tests/comparisons/*</exclude-pattern>
<rule ref="CakePHP" />
</ruleset>
2 changes: 0 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ parameters:
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
excludePaths:
- tests/comparisons/*
24 changes: 13 additions & 11 deletions tests/TestCase/Command/ChangeLogCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,29 @@
*/
namespace BEdita\Core\Test\TestCase\Command;

use BEdita\DevTools\Command\ChangeLogCommand;
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
use Cake\Core\Configure;
use Cake\Http\Client\Adapter\Stream;
use Cake\Http\Client\Response;
use Cake\Routing\Router;
use Cake\TestSuite\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\CoversMethod;

/**
* {@see BEdita\DevTools\Command\ChangeLogCommand} Test Case
*
* @coversDefaultClass \BEdita\DevTools\Command\ChangeLogCommand
*/
#[CoversClass(ChangeLogCommand::class)]
#[CoversMethod(ChangeLogCommand::class, 'buildOptionParser')]
#[CoversMethod(ChangeLogCommand::class, 'classify')]
#[CoversMethod(ChangeLogCommand::class, 'createChangeLog')]
#[CoversMethod(ChangeLogCommand::class, 'execute')]
#[CoversMethod(ChangeLogCommand::class, 'fetchPrs')]
#[CoversMethod(ChangeLogCommand::class, 'filterItems')]
#[CoversMethod(ChangeLogCommand::class, 'initialize')]
#[CoversMethod(ChangeLogCommand::class, 'loglines')]
#[CoversMethod(ChangeLogCommand::class, 'saveChangeLog')]
class ChangeLogCommandTest extends TestCase
{
use ConsoleIntegrationTestTrait;
Expand All @@ -45,7 +56,6 @@ public function setUp(): void
* Test buildOptionParser method
*
* @return void
* @covers ::buildOptionParser()
*/
public function testBuildOptionParser()
{
Expand All @@ -58,14 +68,6 @@ public function testBuildOptionParser()
* Test `execute` method
*
* @return void
* @covers ::execute()
* @covers ::initialize()
* @covers ::fetchPrs()
* @covers ::classify()
* @covers ::createChangeLog()
* @covers ::saveChangeLog()
* @covers ::filterItems()
* @covers ::loglines()
*/
public function testExecute(): void
{
Expand Down
41 changes: 30 additions & 11 deletions tests/TestCase/Command/ResourcesMigrationCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@
use Cake\Routing\Router;
use Cake\TestSuite\StringCompareTrait;
use Cake\TestSuite\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\CoversMethod;

/**
* Test resources migration task.
*
* @coversDefaultClass \BEdita\DevTools\Command\ResourcesMigrationCommand
* Test resources migration task
*/
#[CoversClass(ResourcesMigrationCommand::class)]
#[CoversMethod(ResourcesMigrationCommand::class, 'bake')]
#[CoversMethod(ResourcesMigrationCommand::class, 'buildOptionParser')]
#[CoversMethod(ResourcesMigrationCommand::class, 'fileName')]
#[CoversMethod(ResourcesMigrationCommand::class, 'name')]
#[CoversMethod(ResourcesMigrationCommand::class, 'template')]
class ResourcesMigrationCommandTest extends TestCase
{
use ConsoleIntegrationTestTrait;
Expand All @@ -48,7 +54,7 @@ public function setUp(): void
Router::reload();
$this->loadPlugins(['Bake']);
$this->setAppNamespace('BEdita\DevTools\Test\TestApp');
$this->_compareBasePath = Plugin::path('BEdita/DevTools') . 'tests' . DS . 'comparisons' . DS . 'Migrations' . DS;
$this->_compareBasePath = Plugin::path('BEdita/DevTools') . 'tests' . DS . 'Migrations' . DS;
}

/**
Expand All @@ -67,7 +73,6 @@ public function tearDown(): void
* Test `name`.
*
* @return void
* @covers ::name()
*/
public function testName(): void
{
Expand All @@ -81,7 +86,6 @@ public function testName(): void
* Test `fileName`.
*
* @return void
* @covers ::fileName()
*/
public function testFileName(): void
{
Expand All @@ -103,7 +107,6 @@ public function setArgs(Arguments $args): void
* Test `template`.
*
* @return void
* @covers ::template()
*/
public function testTemplate(): void
{
Expand All @@ -117,8 +120,6 @@ public function testTemplate(): void
* Test `bake`.
*
* @return void
* @covers ::bake()
* @covers ::buildOptionParser()
*/
public function testBake(): void
{
Expand All @@ -140,8 +141,26 @@ public function testBake(): void
$this->createdFiles[] = $phpFile;
$this->createdFiles[] = $yamlFile;

self::assertSameMigration((string)$phpResult, (string)file_get_contents($this->_compareBasePath . 'testMyMigration.php'));
self::assertSameMigration((string)$yamlResult, (string)file_get_contents($this->_compareBasePath . 'testMyMigration.yml'));
$expectedPhp = <<<PHP
<?php
use BEdita\Core\Migration\ResourcesMigration;

class MyMigration extends ResourcesMigration
{
}
PHP;
self::assertSameMigration((string)$phpResult, $expectedPhp);
$expectedYaml = <<<YAML
# MyMigration migration
---

#create:

#update:

#remove:
YAML;
self::assertSameMigration((string)$yamlResult, $expectedYaml);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/TestCase/Middleware/HtmlMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
use Cake\Http\Response;
use Cake\Http\ServerRequest;
use Cake\TestSuite\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

/**
* @covers \BEdita\DevTools\Middleware\HtmlMiddleware
* {@see BEdita\DevTools\Middleware\HtmlMiddleware} Test Case
*/
#[CoversClass(HtmlMiddleware::class)]
class HtmlMiddlewareTest extends TestCase
{
/**
Expand Down
9 changes: 5 additions & 4 deletions tests/TestCase/Panel/ConfigurationPanelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
use BEdita\DevTools\Panel\ConfigurationPanel;
use Cake\Core\Configure;
use Cake\TestSuite\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\CoversMethod;

/**
* Test configuration panel.
*
* @coversDefaultClass \BEdita\DevTools\Panel\ConfigurationPanel
* {@see BEdita\DevTools\Panel\ConfigurationPanel} Test Case
*/
#[CoversClass(ConfigurationPanel::class)]
#[CoversMethod(ConfigurationPanel::class, 'initialize')]
class ConfigurationPanelTest extends TestCase
{
/**
Expand Down Expand Up @@ -62,7 +64,6 @@ public function tearDown(): void
* Check data being serialized in panel.
*
* @return void
* @covers ::initialize()
*/
public function testData(): void
{
Expand Down
12 changes: 7 additions & 5 deletions tests/TestCase/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@
use Cake\Http\MiddlewareQueue;
use Cake\Http\ServerRequest;
use Cake\Routing\Middleware\AssetMiddleware;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\CoversMethod;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

/**
* Test {@see \BEdita\DevTools\Plugin}.
*
* @coversDefaultClass \BEdita\DevTools\Plugin
*/
#[CoversClass(Plugin::class)]
#[CoversMethod(Plugin::class, 'bootstrap')]
#[CoversMethod(Plugin::class, 'middleware')]
class PluginTest extends TestCase
{
/**
Expand All @@ -53,7 +57,6 @@ protected function setUp(): void
* Test {@see Plugin::bootstrap()} method.
*
* @return void
* @covers ::bootstrap()
*/
public function testBootstrap(): void
{
Expand Down Expand Up @@ -105,9 +108,8 @@ public static function middlewareProvider(): array
* @param class-string[] $expected Expected middleware queue.
* @param bool|null $acceptHtml Value of `Accept.html` configuration.
* @return void
* @dataProvider middlewareProvider()
* @covers ::middleware()
*/
#[DataProvider('middlewareProvider')]
public function testMiddleware(array $expected, ?bool $acceptHtml): void
{
$queue = new MiddlewareQueue();
Expand Down
4 changes: 2 additions & 2 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
]);

Cache::setConfig([
'_cake_core_' => [
'_cake_translations_' => [
'engine' => 'File',
'prefix' => 'cake_core_',
'prefix' => 'cake_translations_',
'serialize' => true,
],
'_cake_model_' => [
Expand Down
6 changes: 0 additions & 6 deletions tests/comparisons/Migrations/testMyMigration.php

This file was deleted.

8 changes: 0 additions & 8 deletions tests/comparisons/Migrations/testMyMigration.yml

This file was deleted.