1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 06:38:00 +02:00

Eliminated notice failures in e107Test

- FIX: e107::getTemplate() could be run without the necessary plugin LANs
- FIX: e107Test::testGetInstance() included e107_config.php too many times
- FIX: Empty check in e107Test::testGetTemplate()
This commit is contained in:
Nick Liu
2020-01-18 11:55:13 +01:00
parent 91660a2c32
commit f5f145485a
2 changed files with 11 additions and 3 deletions

View File

@@ -2837,6 +2837,15 @@ class e107
self::getMessage()->addDebug( "Attempting to load Template File: ".$path );
}
/**
* "front" and "global" LANs might not be loaded come self::_getTemplate(),
* so the following calls to self::plugLan() fix that.
*/
self::plugLan($plug_name, null, true);
self::plugLan($plug_name, null, false);
self::plugLan($plug_name, 'global', true);
self::plugLan($plug_name, 'global', false);
$id = str_replace('/', '_', $id);
$ret = self::_getTemplate($id, $key, $reg_path, $path, $info);

View File

@@ -39,7 +39,7 @@ class e107Test extends \Codeception\Test\Unit
public function testInitCore()
{
//$res = null;
include(APP_PATH.'/e107_config.php'); // contains $E107_CONFIG = array('site_path' => '000000test');
include_once(APP_PATH.'/e107_config.php'); // contains $E107_CONFIG = array('site_path' => '000000test');
$e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY','UPLOADS_DIRECTORY','SYSTEM_DIRECTORY', 'MEDIA_DIRECTORY','CACHE_DIRECTORY','LOGS_DIRECTORY', 'CORE_DIRECTORY', 'WEB_DIRECTORY');
$sql_info = compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix', 'mySQLport');
@@ -691,12 +691,11 @@ class e107Test extends \Codeception\Test\Unit
*/
public function testGetTemplate()
{
e107::getConfig()->set('sitetheme', '_blank');
$template = e107::getTemplate('download', null, null); // theme override is enabled by default.
$this->assertEquals('{DOWNLOAD_BREADCRUMB} Custom', $template['header']); // ie. should be from _blank theme download template (override of plugin).
$footer = is_null($template['footer']); // theme overrides everything, since merge is not enabled. theme does not contain 'footer'.
$footer = empty($template['footer']); // theme overrides everything, since merge is not enabled. theme does not contain 'footer'.
$this->assertTrue($footer);
$template = e107::getTemplate('download', null, null, false); // theme override is disabled.