Skip to content

Commit

Permalink
Extend Theme
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomano committed Nov 2, 2024
1 parent 7996ff1 commit 303e03b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Compat/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use function loadJavaScriptFile;
use function loadEssentialThemeData;
use function loadTemplate;
use function loadSubTemplate;

class Theme
{
Expand Down Expand Up @@ -87,4 +88,9 @@ public static function loadTemplate(string $template): void
{
loadTemplate($template);
}

public static function loadSubTemplate(string $sub_template_name, bool $fatal = false): void
{
loadSubTemplate($sub_template_name, $fatal);
}
}
6 changes: 6 additions & 0 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ function loadTemplate(string $name): void
}
}

if (! function_exists('loadSubTemplate')) {
function loadSubTemplate(string $sub_template_name, bool $fatal = false): void
{
}
}

if (! function_exists('JavaScriptEscape')) {
function JavaScriptEscape(...$params): string
{
Expand Down
11 changes: 11 additions & 0 deletions tests/Unit/ThemeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,14 @@

expect($result)->toBeSuccess();
});

test('loadSubTemplate method', function () {
try {
$this->theme::loadSubTemplate('Test');
$result = 'success';
} catch (Exception $e) {
$result = $e->getMessage();
}

expect($result)->toBeSuccess();
});

0 comments on commit 303e03b

Please sign in to comment.