Files
FOSSBilling/tests/Unit/Box/TwigLoaderTest.php
83949ce8f0 Apply PHP Code Styling & Quality Changes (#3705)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2026-06-03 11:31:36 +01:00

32 lines
943 B
PHP

<?php
/**
* Copyright 2022-2026 FOSSBilling
* SPDX-License-Identifier: Apache-2.0.
*
* @copyright FOSSBilling (https://www.fossbilling.org)
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
*/
declare(strict_types=1);
use FOSSBilling\Twig\Enum\AppArea;
use FOSSBilling\Twig\TwigLoader;
use Twig\Error\LoaderError;
test('templates', function (): void {
$loader = new TwigLoader(AppArea::CLIENT, PATH_THEMES . DIRECTORY_SEPARATOR . 'huraga');
$test = $loader->getSourceContext('mod_page_login.html.twig');
$test2 = $loader->getSourceContext('error.html.twig');
expect($test)->toBeObject();
expect($test2)->toBeObject();
});
test('exception', function (): void {
$loader = new TwigLoader(AppArea::CLIENT, PATH_THEMES . DIRECTORY_SEPARATOR . 'huraga');
expect(fn (): Twig\Source => $loader->getSourceContext('mod_non_existing_settings.html.twig'))
->toThrow(LoaderError::class);
});