-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from bedita/feat/3.0.0
Refactor structure using Plugin object and add new TwigView
- Loading branch information
Showing
11 changed files
with
185 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* BEdita, API-first content management framework | ||
* Copyright 2020 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. | ||
*/ | ||
namespace BEdita\WebTools; | ||
|
||
use BEdita\WebTools\Command\CacheClearallCommand; | ||
use Cake\Console\CommandCollection; | ||
use Cake\Core\BasePlugin; | ||
use Cake\Core\PluginApplicationInterface; | ||
|
||
/** | ||
* Plugin class for BEdita\WebTools. | ||
*/ | ||
class Plugin extends BasePlugin | ||
{ | ||
/** | ||
* Load routes or not | ||
* | ||
* @var bool | ||
*/ | ||
protected $routesEnabled = false; | ||
|
||
/** | ||
* Use `cache clear_all` from BEdita\WebTools\Command\CacheClearallCommand | ||
* | ||
* @param \Cake\Console\CommandCollection $commands Console commands. | ||
* @return \Cake\Console\CommandCollection | ||
*/ | ||
public function console(CommandCollection $commands): CommandCollection | ||
{ | ||
parent::console($commands); | ||
$commands->remove('cache clear_all'); | ||
$commands->add('cache clear_all', CacheClearallCommand::class); | ||
|
||
return $commands; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function bootstrap(PluginApplicationInterface $app): void | ||
{ | ||
// Call parent to load bootstrap from files. | ||
parent::bootstrap($app); | ||
|
||
// Load more plugins here | ||
$app->addPlugin('Cake/TwigView'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* BEdita, API-first content management framework | ||
* Copyright 2018 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. | ||
*/ | ||
namespace BEdita\WebTools\Test\TestCase; | ||
|
||
use BEdita\WebTools\Command\CacheClearallCommand; | ||
use Cake\Console\CommandCollection; | ||
use Cake\TestSuite\TestCase; | ||
use TestApp\Application; | ||
|
||
/** | ||
* {@see BEdita\WebTools\Plugin} Test Case | ||
* | ||
* @coversDefaultClass \BEdita\WebTools\Plugin | ||
*/ | ||
class PluginTest extends TestCase | ||
{ | ||
/** | ||
* Test `console` method | ||
* | ||
* @return void | ||
* | ||
* @covers ::console | ||
*/ | ||
public function testConsole(): void | ||
{ | ||
$app = new Application(CONFIG); | ||
$commands = $app->console(new CommandCollection([])); | ||
$commands = $app->pluginConsole($commands); | ||
$cacheClearAll = $commands->get('cache clear_all'); | ||
static::assertNotEmpty($cacheClearAll); | ||
static::assertEquals(CacheClearallCommand::class, $cacheClearAll); | ||
} | ||
} |
Oops, something went wrong.