diff --git a/tests/Support/Parsers/ShortcodeTest.php b/tests/Support/Parsers/ShortcodeTest.php index e2502f33..806e5d73 100644 --- a/tests/Support/Parsers/ShortcodeTest.php +++ b/tests/Support/Parsers/ShortcodeTest.php @@ -3,15 +3,26 @@ declare(strict_types=1); use Thunder\Shortcode\ShortcodeFacade; +use Thunder\Shortcode\EventHandler\FilterRawEventHandler; +use Thunder\Shortcode\Events; +use Thunder\Shortcode\Shortcode\ShortcodeInterface; test('test getInstance() method', function () { $this->assertInstanceOf(ShortcodeFacade::class, flextype('shortcode')->getInstance()); }); -test('test addEventHandler() method', function () { +test('test addHandler() method', function () { $this->assertInstanceOf(ShortcodeFacade::class, flextype('shortcode')->addHandler('foo', static function() { return ''; })); }); +test('test addEventHandler() method', function () { + flextype('shortcode')->addHandler('barz', static function () { + return 'Barz'; + }); + flextype('shortcode')->addEventHandler(Events::FILTER_SHORTCODES, new FilterRawEventHandler(['barz'])); + $this->assertEquals('Barz', flextype('shortcode')->process('[barz]')); +}); + test('test parse() method', function () { $this->assertInstanceOf(ShortcodeFacade::class, flextype('shortcode')->addHandler('bar', static function() { return ''; })); $this->assertTrue(is_array(flextype('shortcode')->parse('[bar]')));