-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
2 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 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,17 @@ | ||
<?php | ||
|
||
use Illuminate\Support\HtmlString; | ||
|
||
if (! function_exists('shortcodes')) { | ||
|
||
/** | ||
* Render shortcodes | ||
* | ||
* @param string $string | ||
* @return string|HtmlString | ||
*/ | ||
function shortcodes($string) | ||
{ | ||
return app('shortcodes')->render($string); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
namespace Vedmant\LaravelShortcodes\Tests\Unit; | ||
|
||
use Vedmant\LaravelShortcodes\Tests\Resources\BShortcode; | ||
use Vedmant\LaravelShortcodes\Tests\TestCase; | ||
|
||
class HelpersTest extends TestCase | ||
{ | ||
public function testFunction() | ||
{ | ||
$this->assertTrue(function_exists('shortcodes')); | ||
} | ||
|
||
public function testRenderWithHelper() | ||
{ | ||
$this->manager->add('b', BShortcode::class); | ||
|
||
$rendered = \shortcodes('[b class="test"]Content[/b]'); | ||
$this->assertEquals("<b class=\"test\">Content</b>", (string) $rendered); | ||
} | ||
} |