diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index a6118e8..452ae52 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -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"]'
diff --git a/composer.json b/composer.json
index f2b8ab5..b943ea7 100644
--- a/composer.json
+++ b/composer.json
@@ -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": {
@@ -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
}
}
}
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index e2feb5b..3b712c4 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -4,11 +4,11 @@
tests
+
+
-
-
- /tests/comparisons/*
+
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index ea5a195..fd98fa8 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -10,5 +10,3 @@ parameters:
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
- excludePaths:
- - tests/comparisons/*
diff --git a/tests/TestCase/Command/ChangeLogCommandTest.php b/tests/TestCase/Command/ChangeLogCommandTest.php
index 716c644..6043956 100644
--- a/tests/TestCase/Command/ChangeLogCommandTest.php
+++ b/tests/TestCase/Command/ChangeLogCommandTest.php
@@ -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;
@@ -45,7 +56,6 @@ public function setUp(): void
* Test buildOptionParser method
*
* @return void
- * @covers ::buildOptionParser()
*/
public function testBuildOptionParser()
{
@@ -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
{
diff --git a/tests/TestCase/Command/ResourcesMigrationCommandTest.php b/tests/TestCase/Command/ResourcesMigrationCommandTest.php
index 98fb625..76f8f9f 100644
--- a/tests/TestCase/Command/ResourcesMigrationCommandTest.php
+++ b/tests/TestCase/Command/ResourcesMigrationCommandTest.php
@@ -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;
@@ -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;
}
/**
@@ -67,7 +73,6 @@ public function tearDown(): void
* Test `name`.
*
* @return void
- * @covers ::name()
*/
public function testName(): void
{
@@ -81,7 +86,6 @@ public function testName(): void
* Test `fileName`.
*
* @return void
- * @covers ::fileName()
*/
public function testFileName(): void
{
@@ -103,7 +107,6 @@ public function setArgs(Arguments $args): void
* Test `template`.
*
* @return void
- * @covers ::template()
*/
public function testTemplate(): void
{
@@ -117,8 +120,6 @@ public function testTemplate(): void
* Test `bake`.
*
* @return void
- * @covers ::bake()
- * @covers ::buildOptionParser()
*/
public function testBake(): void
{
@@ -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 = << [
+ '_cake_translations_' => [
'engine' => 'File',
- 'prefix' => 'cake_core_',
+ 'prefix' => 'cake_translations_',
'serialize' => true,
],
'_cake_model_' => [
diff --git a/tests/comparisons/Migrations/testMyMigration.php b/tests/comparisons/Migrations/testMyMigration.php
deleted file mode 100644
index 05fe535..0000000
--- a/tests/comparisons/Migrations/testMyMigration.php
+++ /dev/null
@@ -1,6 +0,0 @@
-