diff --git a/CHANGELOG.md b/CHANGELOG.md
index d9c9a823a..ceead92cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# 2.x branch
## 2.31 branch
+### 2.31.6
+* fixed the `connector.minimal.php` file for ElFinder and the `FixElFinderCommand`: the Composer autoload is now
+ correctly loaded via absolute path;
+* removed the default `userbar` and all code related;
+* little fixes.
+
### 2.31.5
* `login` layout changed to `single-column`. This name clarifies that it can be used for various purposes (login, sign
up, but also error views);
diff --git a/config/elfinder/connector.minimal.php b/config/elfinder/connector.minimal.php
index ec5f49261..32b80628d 100644
--- a/config/elfinder/connector.minimal.php
+++ b/config/elfinder/connector.minimal.php
@@ -1,17 +1,19 @@
isEmpty('id')) {
header('HTTP/1.0 401 Unauthorized');
echo '{"error": "Login failed."}';
exit;
}
-is_readable('./vendor/autoload.php') && require './vendor/autoload.php';
-require './autoload.php';
-
/**
* Control file access using "accessControl" callback.
* This method will disable accessing files/folders starting from '.' (dot)
@@ -28,7 +30,7 @@ function access($attr, $path, $data, $volume, $isDir, $relpath)
$basename = basename($path);
return $basename[0] === '.' // if file/folder begins with '.' (dot)
- && strlen($relpath) !== 1 // but with out volume root
+ && strlen($relpath) !== 1 // but without volume root
? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true
: null; //else elFinder decide it itself
}
@@ -53,7 +55,7 @@ function access($attr, $path, $data, $volume, $isDir, $relpath)
'path' => '{{UPLOADS_PATH}}.trash',
'tmbURL' => '{{UPLOADS_URL}}/.trash/.tmb/',
'winHashFix' => DIRECTORY_SEPARATOR !== '/', // to make hash same to Linux one on windows too
- 'uploadDeny' => ['all'], // Recomend the same settings as the original volume that uses the trash
+ 'uploadDeny' => ['all'], // Recommend the same settings as the original volume that uses the trash
'uploadAllow' => ['image', 'text/plain'], // Same as above
'uploadOrder' => ['deny', 'allow'], // Same as above
'accessControl' => 'access', // Same as above
diff --git a/config/me_cms.php b/config/me_cms.php
index 1e1f38536..411d60c55 100644
--- a/config/me_cms.php
+++ b/config/me_cms.php
@@ -184,8 +184,5 @@
'reset_password' => true,
//Signup (enabled or disabled)
'signup' => true,
- //Displays the userbar. This will have effect only on the frontend; in
- // the backend, the userbar will always be visible
- 'userbar' => true,
],
]];
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index 1d20a3f03..1607a2380 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -36,11 +36,6 @@
parent::__construct($name, $data, $dataName)
-
-
- \Cake\Collection\CollectionInterface<array{class: class-string, name: string}>
-
-
$this->extend('MeCms./common/form');
@@ -51,6 +46,11 @@
$this->extend('MeCms./common/form');
+
+
+ $this->extend('/common/view');
+
+
diff --git a/src/Command/Install/FixElFinderCommand.php b/src/Command/Install/FixElFinderCommand.php
index 5da83cdce..a96b09c46 100644
--- a/src/Command/Install/FixElFinderCommand.php
+++ b/src/Command/Install/FixElFinderCommand.php
@@ -54,8 +54,18 @@ protected function createConnectorMinimal(ConsoleIo $io): void
return;
}
+ $Filesystem = new Filesystem();
+ $autoload = $Filesystem->concatenate(APP, 'vendor', 'autoload.php');
$origin = Plugin::path('MeCms', 'config' . DS . 'elfinder' . DS . 'connector.minimal.php');
- $content = str_replace(['{{UPLOADS_PATH}}', '{{UPLOADS_URL}}'], [Filesystem::instance()->addSlashTerm(UPLOADED), Router::url('/files', true)], file_get_contents($origin) ?: '');
+ $content = str_replace([
+ '{{AUTOLOAD_PATH}}',
+ '{{UPLOADS_PATH}}',
+ '{{UPLOADS_URL}}',
+ ], [
+ is_readable($autoload) ? $autoload : $Filesystem->concatenate(ROOT, 'vendor', 'autoload.php'),
+ $Filesystem->addSlashTerm(UPLOADED),
+ Router::url('/files', true),
+ ], file_get_contents($origin) ?: '');
$io->createFile($target, $content);
}
diff --git a/src/Controller/Admin/SystemsController.php b/src/Controller/Admin/SystemsController.php
index b8d478abb..ed9d1343d 100644
--- a/src/Controller/Admin/SystemsController.php
+++ b/src/Controller/Admin/SystemsController.php
@@ -130,8 +130,8 @@ protected function clearSitemap(): bool
* Temporary cleaner (assets, cache, logs, sitemap and thumbnails)
* @param string $type Type
* @return \Cake\Http\Response|null
- * @throws \Symfony\Component\Filesystem\Exception\IOException
- * @throws \Symfony\Component\Finder\Exception\DirectoryNotFoundException
+ * @throws \Tools\Exception\MethodNotExistsException
+ * @throws \Tools\Exception\NotReadableException
*/
public function tmpCleaner(string $type): ?Response
{
diff --git a/src/Model/Table/PostsTable.php b/src/Model/Table/PostsTable.php
index ef286fd7b..89119cc92 100644
--- a/src/Model/Table/PostsTable.php
+++ b/src/Model/Table/PostsTable.php
@@ -61,6 +61,7 @@ class PostsTable extends PostsAndPagesTables
* @param \ArrayObject $data Request data
* @return void
* @since 2.15.2
+ * @noinspection PhpUnusedParameterInspection
*/
public function beforeMarshal(EventInterface $event, ArrayObject $data): void
{
diff --git a/src/Model/Table/UsersTable.php b/src/Model/Table/UsersTable.php
index 664e614ee..b187d3408 100644
--- a/src/Model/Table/UsersTable.php
+++ b/src/Model/Table/UsersTable.php
@@ -64,6 +64,7 @@ protected function _initializeSchema(TableSchemaInterface $schema): TableSchemaI
* @param \ArrayObject $options Options
* @return void
* @since 2.16.1
+ * @noinspection PhpUnusedParameterInspection
*/
public function beforeMarshal(EventInterface $event, ArrayObject $data, ArrayObject $options): void
{
diff --git a/src/ORM/PostsAndPagesTables.php b/src/ORM/PostsAndPagesTables.php
index d32c937c2..cd2904f64 100644
--- a/src/ORM/PostsAndPagesTables.php
+++ b/src/ORM/PostsAndPagesTables.php
@@ -86,6 +86,7 @@ public function afterSave(EventInterface $event, EntityInterface $entity): void
* @return void
* @throws \Tools\Exception\NotWritableException
* @since 2.17.0
+ * @noinspection PhpUnusedParameterInspection
*/
public function beforeSave(EventInterface $event, EntityInterface $entity): void
{
diff --git a/src/Utility/StaticPage.php b/src/Utility/StaticPage.php
index 385e35fc2..debfdd68d 100644
--- a/src/Utility/StaticPage.php
+++ b/src/Utility/StaticPage.php
@@ -54,7 +54,6 @@ public static function getPaths(): array
/**
* Gets all static pages
* @return \Cake\Collection\CollectionInterface Collection of static pages
- * @throws \ErrorException
*/
public static function all(): CollectionInterface
{
diff --git a/src/View/View.php b/src/View/View.php
index dbd648658..8626c576f 100644
--- a/src/View/View.php
+++ b/src/View/View.php
@@ -59,14 +59,12 @@ protected function getTitleForLayout(): string
return $title;
}
- //If exists, it adds the title set by the controller, as if it has
- // been set via `$this->View->set()`
+ //If exists, it adds the title set by the controller, as if it has been set via `$this->View->set()`
if ($this->get('title')) {
- $title = sprintf('%s - %s', $this->get('title'), $title);
- //Else, if exists, it adds the title set by the current view, as if
- // it has been set via `$this->View->Blocks->set()`
+ $title = $this->get('title') . ' - ' . $title;
+ //Else, if exists, it adds the title set by the current view, as if it has been set via `$this->View->Blocks->set()`
} elseif ($this->fetch('title')) {
- $title = sprintf('%s - %s', $this->fetch('title'), $title);
+ $title = $this->fetch('title') . ' - ' . $title;
}
return $this->titleForLayout = $title;
diff --git a/src/View/View/AppView.php b/src/View/View/AppView.php
index f729353c2..eca978701 100644
--- a/src/View/View/AppView.php
+++ b/src/View/View/AppView.php
@@ -27,12 +27,6 @@
*/
class AppView extends View
{
- /**
- * Internal property to set the userbar elements
- * @var array
- */
- protected array $userbar = [];
-
/**
* Internal method to set some blocks
* @return void
@@ -86,20 +80,6 @@ public function renderLayout(string $content, ?string $layout = null): string
$this->setBlocks();
- //Assign the userbar
- $this->assign('userbar', implode(PHP_EOL, array_map(fn($element): string => $this->Html->li($element), $this->userbar)));
-
return parent::renderLayout($content, $layout);
}
-
- /**
- * Adds content to the userbar
- * @param string ...$content Contents as string or an array of contents
- * @return void
- * @since 2.29.5
- */
- public function addToUserbar(string ...$content): void
- {
- $this->userbar = [...$this->userbar, $content];
- }
}
diff --git a/templates/Pages/view.php b/templates/Pages/view.php
index 4a490862c..c16a819f0 100644
--- a/templates/Pages/view.php
+++ b/templates/Pages/view.php
@@ -11,32 +11,14 @@
* @copyright Copyright (c) Mirko Pagliai
* @link https://github.com/mirko-pagliai/me-cms
* @license https://opensource.org/licenses/mit-license.php MIT License
- *
- * @var \MeCms\Model\Entity\Page $page
*/
-$this->extend('/common/view');
-$this->assign('title', $page->get('title'));
/**
- * Userbar
+ * @var \MeCms\Model\Entity\Page $page
+ * @var \MeCms\View\View\AppView $this
*/
-$class = 'badge badge-warning';
-if (!$page->get('active')) {
- $this->addToUserbar($this->Html->span(I18N_DRAFT, compact('class')));
-}
-if ($page->get('created')->isFuture()) {
- $this->addToUserbar($this->Html->span(I18N_SCHEDULED, compact('class')));
-}
-$this->addToUserbar($this->Html->link(
- __d('me_cms', 'Edit page'),
- ['action' => 'edit', $page->get('id'), 'prefix' => ADMIN_PREFIX],
- ['class' => 'nav-link', 'icon' => 'pencil-alt', 'target' => '_blank']
-));
-$this->addToUserbar($this->Form->postLink(
- __d('me_cms', 'Delete page'),
- ['action' => 'delete', $page->get('id'), 'prefix' => ADMIN_PREFIX],
- ['class' => 'nav-link text-danger', 'icon' => 'trash-alt', 'confirm' => I18N_SURE_TO_DELETE, 'target' => '_blank']
-));
+$this->extend('/common/view');
+$this->assign('title', $page->get('title'));
/**
* Breadcrumb
diff --git a/templates/PagesCategories/view.php b/templates/PagesCategories/view.php
index 6a4c13e09..a1d3a2326 100644
--- a/templates/PagesCategories/view.php
+++ b/templates/PagesCategories/view.php
@@ -11,37 +11,22 @@
* @copyright Copyright (c) Mirko Pagliai
* @link https://github.com/mirko-pagliai/me-cms
* @license https://opensource.org/licenses/mit-license.php MIT License
+ */
+use MeCms\Model\Entity\Page;
+/**
* @var \MeCms\Model\Entity\PagesCategory $category
* @var \MeCms\View\View\AppView $this
*/
-use MeCms\Model\Entity\Page;
-
$this->extend('/common/index');
$this->assign('title', $category->get('title'));
-/**
- * Userbar
- */
-$this->addToUserbar($this->Html->link(
- __d('me_cms', 'Edit category'),
- ['action' => 'edit', $category->get('id'), 'prefix' => ADMIN_PREFIX],
- ['class' => 'nav-link', 'icon' => 'pencil-alt', 'target' => '_blank']
-));
-$this->addToUserbar($this->Form->postLink(
- __d('me_cms', 'Delete category'),
- ['action' => 'delete', $category->get('id'), 'prefix' => ADMIN_PREFIX],
- ['class' => 'nav-link text-danger', 'icon' => 'trash-alt', 'confirm' => I18N_SURE_TO_DELETE, 'target' => '_blank']
-));
-
/**
* Breadcrumb
*/
$this->Breadcrumbs->add($category->get('title'), ['_name' => 'pagesCategory', $category->get('title')]);
-$pages = collection($category->get('pages'))
- ->map(fn(Page $page): string => $this->Html->link($page->get('title'), $page->get('url')))
- ->toList();
+$pagesLinks = array_map(fn(Page $page): string => $this->Html->link($page->get('title'), $page->get('url')), $category->get('pages'));
-echo $this->Html->ul($pages, ['icon' => 'caret-right']);
+echo $this->Html->ul($pagesLinks, ['icon' => 'caret-right']);
diff --git a/templates/Posts/view.php b/templates/Posts/view.php
index 1aceb944c..e7a49839f 100644
--- a/templates/Posts/view.php
+++ b/templates/Posts/view.php
@@ -11,38 +11,18 @@
* @copyright Copyright (c) Mirko Pagliai
* @link https://github.com/mirko-pagliai/me-cms
* @license https://opensource.org/licenses/mit-license.php MIT License
- *
+ */
+use MeCms\Model\Entity\Post;
+
+/**
* @var \MeCms\Model\Entity\Post $post
* @var \Cake\Collection\Collection<\MeCms\Model\Entity\Post> $related
* @var \MeCms\View\View\AppView $this
*/
-use MeCms\Model\Entity\Post;
-
$this->extend('/common/view');
$this->assign('title', $post->get('title'));
-/**
- * Userbar
- */
-$class = 'badge badge-warning';
-if (!$post->get('active')) {
- $this->addToUserbar($this->Html->span(I18N_DRAFT, compact('class')));
-}
-if ($post->get('created')->isFuture()) {
- $this->addToUserbar($this->Html->span(I18N_SCHEDULED, compact('class')));
-}
-$this->addToUserbar($this->Html->link(
- __d('me_cms', 'Edit post'),
- ['action' => 'edit', $post->get('id'), 'prefix' => ADMIN_PREFIX],
- ['class' => 'nav-link', 'icon' => 'pencil-alt', 'target' => '_blank']
-));
-$this->addToUserbar($this->Form->postLink(
- __d('me_cms', 'Delete post'),
- ['action' => 'delete', $post->get('id'), 'prefix' => ADMIN_PREFIX],
- ['class' => 'nav-link text-danger', 'icon' => 'trash-alt', 'confirm' => I18N_SURE_TO_DELETE, 'target' => '_blank']
-));
-
/**
* Breadcrumb
*/
@@ -89,14 +69,13 @@
isEmpty()) : ?>
map(fn(Post $post): string => $this->Html->link($post->get('title'), ['_name' => 'post', $post->get('slug')]))
+ $relatedAsLinks = $related->map(fn(Post $post): string => $this->Html->link($post->get('title'), ['_name' => 'post', $post->get('slug')]))
->toArray();
?>
= $this->Html->h5(__d('me_cms', 'Related posts')) ?>
- = $this->Html->ul($relatedAsArray, ['icon' => 'caret-right']) ?>
+ = $this->Html->ul($relatedAsLinks, ['icon' => 'caret-right']) ?>
@@ -109,7 +88,7 @@
- = $this->Html->ul($relatedAsArray, ['icon' => 'caret-right']) ?>
+ = $this->Html->ul($relatedAsLinks, ['icon' => 'caret-right']) ?>
diff --git a/templates/PostsCategories/view.php b/templates/PostsCategories/view.php
index 54860fa8d..10c72492f 100644
--- a/templates/PostsCategories/view.php
+++ b/templates/PostsCategories/view.php
@@ -12,22 +12,13 @@
* @link https://github.com/mirko-pagliai/me-cms
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
-$this->extend('/Posts/index');
-$this->assign('title', $category->get('title'));
/**
- * Userbar
+ * @var \MeCms\Model\Entity\PostsCategory $category
+ * @var \MeCms\View\View\AppView $this
*/
-$this->addToUserbar($this->Html->link(
- __d('me_cms', 'Edit category'),
- ['action' => 'edit', $category->get('id'), 'prefix' => ADMIN_PREFIX],
- ['class' => 'nav-link', 'icon' => 'pencil-alt', 'target' => '_blank']
-));
-$this->addToUserbar($this->Form->postLink(
- __d('me_cms', 'Delete category'),
- ['action' => 'delete', $category->get('id'), 'prefix' => ADMIN_PREFIX],
- ['class' => 'nav-link text-danger', 'icon' => 'trash-alt', 'confirm' => I18N_SURE_TO_DELETE, 'target' => '_blank']
-));
+$this->extend('/Posts/index');
+$this->assign('title', $category->get('title'));
/**
* Breadcrumb
diff --git a/templates/PostsTags/view.php b/templates/PostsTags/view.php
index 135ff81f8..c5b026923 100644
--- a/templates/PostsTags/view.php
+++ b/templates/PostsTags/view.php
@@ -12,17 +12,14 @@
* @link https://github.com/mirko-pagliai/me-cms
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
-$this->extend('/Posts/index');
-$this->assign('title', $title = __d('me_cms', 'Tag {0}', $tag->get('tag')));
/**
- * Userbar
+ * @var \MeCms\Model\Entity\Tag $tag
+ * @var \MeCms\View\View\AppView $this
*/
-$this->addToUserbar($this->Html->link(
- __d('me_cms', 'Edit tag'),
- ['controller' => 'PostsTags', 'action' => 'edit', 'prefix' => ADMIN_PREFIX, $tag->get('id')],
- ['class' => 'nav-link', 'icon' => 'pencil-alt', 'target' => '_blank']
-));
+
+$this->extend('/Posts/index');
+$this->assign('title', $title = __d('me_cms', 'Tag {0}', $tag->get('tag')));
/**
* Breadcrumb
diff --git a/templates/element/userbar.php b/templates/element/userbar.php
deleted file mode 100644
index ae0e13d56..000000000
--- a/templates/element/userbar.php
+++ /dev/null
@@ -1,26 +0,0 @@
-Identity->isLoggedIn()) {
- return;
-}
-
-$this->extend('MeCms.common/userbar');
-
-echo $this->Html->ul([
- $this->Html->link(__d('me_cms', 'Dashboard'), ['_name' => 'dashboard'], ['class' => 'nav-link', 'icon' => 'dashboard']),
-], ['class' => 'navbar-nav me-auto'], ['class' => 'nav-item']);
diff --git a/templates/layout/default.php b/templates/layout/default.php
index 7e51ba7a0..4a1f53d5a 100644
--- a/templates/layout/default.php
+++ b/templates/layout/default.php
@@ -61,7 +61,6 @@
?>
- = $this->element('MeCms.userbar') ?>
Html->h1(getConfigOrFail('main.title'));
diff --git a/templates/layout/single-column.php b/templates/layout/single-column.php
index 58c15d3ab..7c29bed6a 100644
--- a/templates/layout/single-column.php
+++ b/templates/layout/single-column.php
@@ -26,9 +26,12 @@
echo $this->Html->title($this->fetch('title'));
echo $this->fetch('meta');
- echo $this->Asset->css([
+ //CSS files which contain relative paths (and therefore should not be used with `AssetHelper`)
+ echo $this->Html->css([
'/vendor/font-awesome/css/all.min',
'MeCms.fonts',
+ ], ['block' => true]);
+ echo $this->Asset->css([
'/vendor/bootstrap/css/bootstrap.min',
'MeTools.default',
'MeTools.forms',
diff --git a/tests/TestCase/Command/Install/FixElFinderCommandTest.php b/tests/TestCase/Command/Install/FixElFinderCommandTest.php
index 7fe7ad71e..d3b288b07 100644
--- a/tests/TestCase/Command/Install/FixElFinderCommandTest.php
+++ b/tests/TestCase/Command/Install/FixElFinderCommandTest.php
@@ -18,6 +18,7 @@
use Cake\Console\ConsoleIo;
use Cake\Console\TestSuite\StubConsoleOutput;
+use Cake\Routing\Router;
use ErrorException;
use MeCms\Command\Install\FixElFinderCommand;
use MeTools\TestSuite\CommandTestCase;
@@ -28,40 +29,39 @@
*/
class FixElFinderCommandTest extends CommandTestCase
{
- protected const EXPECTED_FILES = [
- ELFINDER . 'php' . DS . 'connector.minimal.php',
- ELFINDER . 'elfinder-cke.html',
- ];
-
- /**
- * @var string
- */
- protected string $command = 'me_cms.fix_el_finder -v';
-
/**
* @uses \MeCms\Command\Install\FixElFinderCommand::execute()
* @test
*/
public function testExecute(): void
{
- array_map('unlink', array_filter(self::EXPECTED_FILES, 'is_writable'));
- $this->exec($this->command);
+ $command = 'me_cms.fix_el_finder -v';
+
+ $Filesystem = new Filesystem();
+ $connector = $Filesystem->concatenate(ELFINDER, 'php', 'connector.minimal.php');
+ $elfinderCke = $Filesystem->concatenate(ELFINDER, 'elfinder-cke.html');
+ array_map('unlink', array_filter([$connector, $elfinderCke], 'file_exists'));
+
+ $this->exec($command);
$this->assertExitSuccess();
- foreach (self::EXPECTED_FILES as $expectedFile) {
- $this->assertOutputContains('Creating file ' . $expectedFile);
- $this->assertOutputContains('Wrote `' . $expectedFile . '`');
- }
$this->assertErrorEmpty();
- $this->assertStringContainsString('\'path\' => \'' . UPLOADED . '\'', file_get_contents(self::EXPECTED_FILES[0]) ?: '');
- $this->assertStringContainsString('getFileCallback', file_get_contents(self::EXPECTED_FILES[1]) ?: '');
+ $this->assertOutputContains('Creating file ' . $connector);
+ $this->assertOutputContains('Wrote `' . $connector . '`');
+ $connectorContent = file_get_contents($connector) ?: '';
+ $this->assertStringContainsString('require_once \'' . Filesystem::instance()->concatenate(APP, 'vendor', 'autoload.php') . '\';', $connectorContent);
+ $this->assertStringContainsString('\'path\' => \'' . UPLOADED . '\'', $connectorContent);
+ $this->assertStringContainsString('\'URL\' => \'' . Router::url('/files', true) . '\'', $connectorContent);
+
+ $this->assertOutputContains('Creating file ' . $elfinderCke);
+ $this->assertOutputContains('Wrote `' . $elfinderCke . '`');
+ $this->assertStringContainsString('getFileCallback', file_get_contents($elfinderCke) ?: '');
//File already exists
- $this->exec($this->command);
+ $this->exec($command);
$this->assertExitSuccess();
- foreach (self::EXPECTED_FILES as $expectedFile) {
- $this->assertOutputContains('File or directory `' . Filesystem::instance()->rtr($expectedFile) . '` already exists');
- }
+ $this->assertOutputContains('File or directory `' . $Filesystem->rtr($connector) . '` already exists');
+ $this->assertOutputContains('File or directory `' . $Filesystem->rtr($elfinderCke) . '` already exists');
//With an exception
$Command = $this->createPartialMock(FixElFinderCommand::class, ['createElfinderCke']);
diff --git a/tests/TestCase/Model/Table/Traits/NextToBePublishedTraitTest.php b/tests/TestCase/Model/Table/Traits/NextToBePublishedTraitTest.php
index 149b22070..2e85e82b1 100644
--- a/tests/TestCase/Model/Table/Traits/NextToBePublishedTraitTest.php
+++ b/tests/TestCase/Model/Table/Traits/NextToBePublishedTraitTest.php
@@ -55,7 +55,7 @@ protected function setUp(): void
*/
public function testGetNextToBePublishedAndSetNextToBePublished(): void
{
- //Creates a record with a future publication time (1 hours)
+ //Creates a record with a future publication time (1 hour)
$future = new FrozenTime('+1 hours');
$entity = $this->Posts->newEntity([
'user_id' => 1,
diff --git a/tests/TestCase/Policy/ControllerResolverTest.php b/tests/TestCase/Policy/ControllerResolverTest.php
index 5aa34b5bc..57a85000a 100644
--- a/tests/TestCase/Policy/ControllerResolverTest.php
+++ b/tests/TestCase/Policy/ControllerResolverTest.php
@@ -40,6 +40,7 @@ public function testGetPolicy(): void
$this->expectException(MissingPolicyException::class);
$this->expectExceptionMessage('Policy for `stdClass` has not been defined');
+ /** @noinspection PhpParamsInspection */
$Resolver->getPolicy(new \stdClass());
}
}
diff --git a/tests/TestCase/TestSuite/TestCaseTest.php b/tests/TestCase/TestSuite/TestCaseTest.php
index ba3307309..cc7c53121 100644
--- a/tests/TestCase/TestSuite/TestCaseTest.php
+++ b/tests/TestCase/TestSuite/TestCaseTest.php
@@ -34,6 +34,7 @@ public function testGetMagicMethod(): void
//With a no existing property
$this->expectException(AssertionFailedError::class);
$this->expectExceptionMessage('Property `noExistingProperty` does not exist');
+ /** @noinspection PhpUndefinedFieldInspection */
$this->noExistingProperty;
}
diff --git a/tests/TestCase/View/View/AppViewTest.php b/tests/TestCase/View/View/AppViewTest.php
index 9777b93bc..e3490c227 100644
--- a/tests/TestCase/View/View/AppViewTest.php
+++ b/tests/TestCase/View/View/AppViewTest.php
@@ -16,6 +16,7 @@
namespace MeCms\Test\TestCase\View\View;
use Cake\Core\Configure;
+use Cake\Http\ServerRequest;
use MeCms\TestSuite\TestCase;
use MeCms\View\View\AppView;
@@ -42,16 +43,14 @@ protected function setUp(): void
Configure::write('MeCms.default.theme', false);
if (empty($this->View)) {
- $this->View = new AppView();
- $this->View->setRequest($this->View->getRequest()->withEnv('REQUEST_URI', '/some-page'));
- $this->View->setPlugin('MeCms');
+ $Request = new ServerRequest();
+ $this->View = new AppView($Request->withEnv('REQUEST_URI', '/some-page'));
}
}
/**
- * Tests for `setBlocks()` method
- * @uses \MeCms\View\View\AppView::setBlocks()
* @test
+ * @uses \MeCms\View\View\AppView::setBlocks()
*/
public function testSetBlocks(): void
{
@@ -68,9 +67,8 @@ public function testSetBlocks(): void
}
/**
- * Tests for `renderLayout()` method
- * @uses \MeCms\View\View\AppView::renderLayout()
* @test
+ * @uses \MeCms\View\View\AppView::renderLayout()
*/
public function testRenderLayout(): void
{
@@ -80,9 +78,8 @@ public function testRenderLayout(): void
}
/**
- * Tests for `renderLayout()` method, with a layout from a theme
- * @uses \MeCms\View\View\AppView::renderLayout()
* @test
+ * @uses \MeCms\View\View\AppView::renderLayout()
*/
public function testRenderLayoutFromTheme(): void
{
@@ -91,23 +88,10 @@ public function testRenderLayoutFromTheme(): void
Configure::write('MeCms.default.theme', 'TestPlugin');
//Reloads the View
- $this->View = new AppView();
- $this->View->setRequest($this->View->getRequest()->withEnv('REQUEST_URI', '/some-page'));
+ $Request = new ServerRequest();
+ $this->View = new AppView($Request->withEnv('REQUEST_URI', '/some-page'));
$this->assertEquals('This is a layout from TestPlugin', $this->View->render('StaticPages/page-from-app'));
$this->assertEquals('default', $this->View->getLayout());
$this->assertEquals('TestPlugin', $this->View->getTheme());
}
-
- /**
- * Tests for `addToUserbar()` method
- * @uses \MeCms\View\View\AppView::addToUserbar()
- * @test
- */
- public function testAddToUserbar(): void
- {
- $this->View->addToUserbar('string');
- $this->View->addToUserbar('first', 'second');
- $this->View->render('StaticPages/page-from-app');
- $this->assertEquals('string' . PHP_EOL . 'first' . PHP_EOL . 'second', $this->View->fetch('userbar'));
- }
}
diff --git a/tests/test_app/TestApp/Plugin/TestPlugin/src/Shell/InstallShell.php b/tests/test_app/TestApp/Plugin/TestPlugin/src/Shell/InstallShell.php
deleted file mode 100644
index 51ddf0aa8..000000000
--- a/tests/test_app/TestApp/Plugin/TestPlugin/src/Shell/InstallShell.php
+++ /dev/null
@@ -1,14 +0,0 @@
- true,
//Signup (enabled or disabled)
'signup' => true,
- //Displays the userbar. This will have effect only on the frontend; in
- // the backend, the userbar will always be visible
- 'userbar' => true,
],
]];
diff --git a/tests/test_app/TestApp/vendor/autoload.php b/tests/test_app/TestApp/vendor/autoload.php
new file mode 100644
index 000000000..e69de29bb
diff --git a/version b/version
index ece754b63..c07452f9e 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-2.31.5
+2.31.6