Skip to content

Commit

Permalink
fixing type error in TinyMCEHelper::beforeRender() (reported by @umer936
Browse files Browse the repository at this point in the history
  • Loading branch information
arusinowski committed Jan 13, 2024
1 parent 84fb0a3 commit 4cc46ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/View/Helper/TinyMCEHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace TinyMCE\View\Helper;

use Cake\Core\Configure;
use Cake\Event\EventInterface;
use Cake\Utility\Inflector;
use Cake\View\Helper;
use Cake\View\View;
Expand Down Expand Up @@ -119,10 +120,11 @@ public function editor(mixed $options = []): void
/**
* beforeRender callback
*
* @param \Cake\Event\EventInterface $event
* @param string $viewFile The view file that is going to be rendered
* @return void
*/
public function beforeRender(string $viewFile): void
public function beforeRender(EventInterface $event, string $viewFile): void
{
$appOptions = Configure::read('TinyMCE.editorOptions');
if ($appOptions !== false && is_array($appOptions)) {
Expand Down
7 changes: 5 additions & 2 deletions tests/TestCase/View/Helper/TinyMceHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace TinyMCE\Test\TestCase\View\Helper;

use Cake\Core\Configure;
use Cake\Event\Event;
use Cake\TestSuite\TestCase;
use Cake\View\Helper\HtmlHelper;
use Cake\View\View;
Expand Down Expand Up @@ -133,7 +134,8 @@ public function testEditorWithConfiguration1(): void
TINYMCE,
['block' => true]
);
$this->TinyMCE->beforeRender('test.ctp');
$event = new Event('test');
$this->TinyMCE->beforeRender($event, 'test.ctp');
$this->TinyMCE->editor(['theme' => 'modern']);
}

Expand Down Expand Up @@ -170,6 +172,7 @@ public function testBeforeRender(): void
'https://cdn.tiny.cloud/1/no-api-key/tinymce/6/tinymce.min.js',
['block' => true, 'referrerpolicy' => true]
);
$this->TinyMCE->beforeRender('test.ctp');
$event = new Event('test');
$this->TinyMCE->beforeRender($event, 'test.ctp');
}
}

0 comments on commit 4cc46ea

Please sign in to comment.