Files
FOSSBilling/tests/library/Box/Box_TwigLoaderTest.php
T
Adam Daley b08fc53d72 Update rewrite rules, improve error handling, and some related cleanup (#1075)
* Rename htaccess to be applied automatically

Rename the htaccess file, improve handling when .htaccess is missing, and remove from .gitignore so that rules are automatically applied on supported web servers.

* Clean up .gitignore file

* Update .htaccess to improve security

Update .htaccess file to improve general security, handle missing mod_rewrite, and to simplify the required rules.

* Improve HTTP and generic error handling

Improve handling of HTTP errors, and make the error handling code more generic to permit catching more errors.

* Remove outdated example web server config files

Remove the outdated and unmaintained example web server configuration files in favour of FOSSBilling/config-generator.

* Remove support for non-search engine friendly URLs

Remove support for non-search engine friendly URLs as these are depreciated.

* Revert "Remove support for non-search engine friendly URLs"

This reverts commit 724b1eb274.

* Update config migration backup handling
2023-04-06 21:59:25 +02:00

47 lines
1.3 KiB
PHP

<?php
/**
* FOSSBilling
*
* @copyright FOSSBilling (https://www.fossbilling.org)
* @license Apache-2.0
*
* This file may contain code previously used in the BoxBilling project.
* Copyright BoxBilling, Inc 2011-2021
*
* This source file is subject to the Apache-2.0 License that is bundled
* with this source code in the file LICENSE
*/
/**
* @group Core
*/
class Box_TwigLoaderTest extends PHPUnit\Framework\TestCase
{
public function testTemplates()
{
$loader = new Box_TwigLoader([
'mods' => PATH_MODS,
'theme' => PATH_THEMES . DIRECTORY_SEPARATOR . 'huraga',
'type' => 'client',
]);
$test = $loader->getSourceContext('mod_page_login.html.twig');
$test2 = $loader->getSourceContext('error.html.twig');
$this->assertIsObject($test);
$this->assertIsObject($test2);
}
public function testException()
{
$loader = new Box_TwigLoader([
'type' => 'client',
'mods' => PATH_MODS,
'theme' => PATH_THEMES . DIRECTORY_SEPARATOR . 'huraga',
]);
$this->expectException(Twig\Error\LoaderError::class);
$test = $loader->getSourceContext('mod_non_existing_settings.html.twig');
$test = $loader->getSourceContext('some_random_name.html.twig');
}
}