From 3c696e825ec1dc5df2b5e62bc2faaefd08487b6d Mon Sep 17 00:00:00 2001 From: Awilum Date: Thu, 5 Aug 2021 11:57:39 +0300 Subject: [PATCH] feat(tests): update tests for shortcodes #562 --- tests/src/flextype/Parsers/ShortcodeTest.php | 18 +++++++++--------- .../Shortcodes/EntriesShortcodeTest.php | 4 ++-- .../Parsers/Shortcodes/RawShortcodeTest.php | 2 +- .../Shortcodes/RegistryShortcodeTest.php | 4 ++-- .../Parsers/Shortcodes/UrlShortcodeTest.php | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/src/flextype/Parsers/ShortcodeTest.php b/tests/src/flextype/Parsers/ShortcodeTest.php index 15d7417b..2d58ee0f 100644 --- a/tests/src/flextype/Parsers/ShortcodeTest.php +++ b/tests/src/flextype/Parsers/ShortcodeTest.php @@ -20,19 +20,19 @@ test('test addEventHandler() method', function () { return 'Barz'; }); parsers()->shortcodes()->addEventHandler(Events::FILTER_SHORTCODES, new FilterRawEventHandler(['barz'])); - $this->assertEquals('Barz', parsers()->shortcodes()->process('[barz]')); + $this->assertEquals('Barz', parsers()->shortcodes()->parse('[barz]')); +}); + +test('test parseText() method', function () { + $this->assertInstanceOf(Thunder\Shortcode\ShortcodeFacade::class, parsers()->shortcodes()->addHandler('bar', static function() { return ''; })); + $this->assertTrue(is_array(parsers()->shortcodes()->parseText('[bar]'))); + $this->assertTrue(is_object(parsers()->shortcodes()->parseText('[bar]')[0])); }); test('test parse() method', function () { - $this->assertInstanceOf(Thunder\Shortcode\ShortcodeFacade::class, parsers()->shortcodes()->addHandler('bar', static function() { return ''; })); - $this->assertTrue(is_array(parsers()->shortcodes()->parse('[bar]'))); - $this->assertTrue(is_object(parsers()->shortcodes()->parse('[bar]')[0])); -}); - -test('test process() method', function () { $this->assertInstanceOf(Thunder\Shortcode\ShortcodeFacade::class, parsers()->shortcodes()->addHandler('zed', static function() { return 'Zed'; })); - $this->assertEquals('Zed', parsers()->shortcodes()->process('[zed]')); - $this->assertEquals('fòôBàřZed', parsers()->shortcodes()->process('fòôBàř[zed]')); + $this->assertEquals('Zed', parsers()->shortcodes()->parse('[zed]')); + $this->assertEquals('fòôBàřZed', parsers()->shortcodes()->parse('fòôBàř[zed]')); }); test('test getCacheID() method', function () { diff --git a/tests/src/flextype/Parsers/Shortcodes/EntriesShortcodeTest.php b/tests/src/flextype/Parsers/Shortcodes/EntriesShortcodeTest.php index 68965801..98f643cb 100644 --- a/tests/src/flextype/Parsers/Shortcodes/EntriesShortcodeTest.php +++ b/tests/src/flextype/Parsers/Shortcodes/EntriesShortcodeTest.php @@ -12,6 +12,6 @@ afterEach(function (): void { test('test entries_fetch shortcode', function () { $this->assertTrue(entries()->create('foo', ['title' => 'Foo'])); - $this->assertEquals('Foo', parsers()->shortcodes()->process('[entries_fetch id="foo" field="title"]')); - $this->assertEquals('Bar', parsers()->shortcodes()->process('[entries_fetch id="foo" field="bar" default="Bar"]')); + $this->assertEquals('Foo', parsers()->shortcodes()->parse('[entries_fetch id="foo" field="title"]')); + $this->assertEquals('Bar', parsers()->shortcodes()->parse('[entries_fetch id="foo" field="bar" default="Bar"]')); }); diff --git a/tests/src/flextype/Parsers/Shortcodes/RawShortcodeTest.php b/tests/src/flextype/Parsers/Shortcodes/RawShortcodeTest.php index 950da38c..ff76c00c 100644 --- a/tests/src/flextype/Parsers/Shortcodes/RawShortcodeTest.php +++ b/tests/src/flextype/Parsers/Shortcodes/RawShortcodeTest.php @@ -13,5 +13,5 @@ afterEach(function (): void { test('test raw shortcode', function () { $this->assertTrue(entries()->create('foo', ['title' => 'Foo'])); $this->assertEquals('[entries_fetch id="foo" field="title"]', - parsers()->shortcodes()->process('[raw][entries_fetch id="foo" field="title"][/raw]')); + parsers()->shortcodes()->parse('[raw][entries_fetch id="foo" field="title"][/raw]')); }); diff --git a/tests/src/flextype/Parsers/Shortcodes/RegistryShortcodeTest.php b/tests/src/flextype/Parsers/Shortcodes/RegistryShortcodeTest.php index 367a6c1e..7734d01c 100644 --- a/tests/src/flextype/Parsers/Shortcodes/RegistryShortcodeTest.php +++ b/tests/src/flextype/Parsers/Shortcodes/RegistryShortcodeTest.php @@ -4,7 +4,7 @@ declare(strict_types=1); test('test registry_get shortcode', function () { $this->assertEquals('Flextype', - parsers()->shortcodes()->process('[registry_get name="flextype.manifest.name"]')); + parsers()->shortcodes()->parse('[registry_get name="flextype.manifest.name"]')); $this->assertEquals('default-value', - parsers()->shortcodes()->process('[registry_get name="item-name" default="default-value"]')); + parsers()->shortcodes()->parse('[registry_get name="item-name" default="default-value"]')); }); diff --git a/tests/src/flextype/Parsers/Shortcodes/UrlShortcodeTest.php b/tests/src/flextype/Parsers/Shortcodes/UrlShortcodeTest.php index 382dbfe0..2cbaf12f 100644 --- a/tests/src/flextype/Parsers/Shortcodes/UrlShortcodeTest.php +++ b/tests/src/flextype/Parsers/Shortcodes/UrlShortcodeTest.php @@ -5,5 +5,5 @@ declare(strict_types=1); test('test registry_get shortcode', function () { registry()->set('flextype.settings.url', 'https://flextype.org'); - $this->assertStringContainsString('https://flextype.org', parsers()->shortcodes()->process('[url]')); + $this->assertStringContainsString('https://flextype.org', parsers()->shortcodes()->parse('[url]')); });