1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +02:00

CoreTemplate tests. FPW BC constant fix.

This commit is contained in:
Cameron
2021-01-11 18:05:29 -08:00
parent 1d8df4c150
commit 56f8389417
14 changed files with 485 additions and 480 deletions

View File

@@ -2018,6 +2018,7 @@ e107::getDebug()->log("Timezone: ".USERTIMEZONE); // remove later on.
define('USER', true);
define('USERID', 1);
define('USERNAME', 'e107-cli');
define('ADMINNAME', 'e107-cli');
define('USERTHEME', false);
define('ADMIN', true);
define('ADMINPERMS', '0');

View File

@@ -38,8 +38,8 @@ See e_HANDLER.mail.php for more information
if (!defined('e107_INIT')) { exit; }
$includeSiteButton = e107::getPref('sitebutton');
e107::lan('core','signup'); // required for when mailer runs under CLI.
e107::coreLan('signup'); // required for when mailer runs under CLI.
e107::coreLan('users', true);
/*
$SIGNUPEMAIL_SUBJECT = LAN_SIGNUP_96.' {SITENAME}';
$SIGNUPEMAIL_USETHEME = 1; // Use CSS STYLE from THEME: 0 = Off, 1 = external, 2 = embedded

View File

@@ -3,80 +3,6 @@
if (!defined('e107_INIT')) { exit; }
if (!defined("USER_WIDTH") && !deftrue('BOOTSTRAP')){ define("USER_WIDTH","width:70%"); }
// ##### FPW TABLE -----------------------------------------------------------------------------
if(!isset($FPW_TABLE))
{
$FPW_TABLE = "
<div style='text-align:center'>
<form method='post' action='".SITEURL."fpw.php' autocomplete='off'>
<table style='".USER_WIDTH."' class='table fborder'>
<tr>
<td class='fcaption' colspan='2'>".LAN_05."</td>
</tr>";
if($pref['allowEmailLogin']==0)
{
$FPW_TABLE .= "
<tr>
<td class='forumheader3' style='width:70%'>".LAN_FPW1.":</td>
<td class='forumheader3' style='width:30%;text-align:center'>
{FPW_USERNAME}
</td>
</tr>";
}
$FPW_TABLE .="
<tr>
<td class='forumheader3' style='width:70%'>".LAN_112.":</td>
<td class='forumheader3 text-left' style='width:30%'>
{FPW_USEREMAIL}
</td>
</tr>";
if(deftrue('USE_IMAGECODE'))
{
$FPW_TABLE .= "
<tr>
<td class='forumheader3' style='width:70%'>{FPW_TABLE_SECIMG_LAN}</td>
<td class='forumheader3 text-left' style='width:30%;'>{FPW_TABLE_SECIMG_HIDDEN} {FPW_TABLE_SECIMG_SECIMG}<br />
{FPW_TABLE_SECIMG_TEXTBOC}<br />
</td>
</tr>";
}
$FPW_TABLE .="
<tr style='vertical-align:top'>
<td class='forumheader' colspan='2' style='text-align:center'>
{FPW_SUBMIT}
</td>
</tr>
</table>
</form>
</div>";
}
// ##### ------------------------------------------------------------------------------------------
// ##### FPW HEADER TABLE -------------------------------------------------------------------------
if(!isset($FPW_TABLE_HEADER))
{
$FPW_TABLE_HEADER = "
<div style='width:100%;text-align:center;margin-left:auto;margin-right:auto'>
<div><br />
{FPW_LOGIN_LOGO}
<br />";
}
// ##### ------------------------------------------------------------------------------------------
// ##### FPW FOOTER TABLE -------------------------------------------------------------------------
if(!isset($FPW_TABLE_FOOTER))
{
$FPW_TABLE_FOOTER = "</div></div>";
}
// ##### ------------------------------------------------------------------------------------------
$FPW_TEMPLATE['form'] = '

View File

@@ -727,7 +727,7 @@ class language{
/**
* Define Legacy LAN constants based on a supplied array.
* @param null $bcList
* @param array $bcList legacyLAN => Replacement-LAN
*/
public function bcDefs($bcList = null)
{

View File

@@ -5,8 +5,10 @@
* Forgotten password language file - Password reset
*
*/
define("PAGE_NAME", "Password Reset");
if(!defined('PAGE_NAME')) // TODO Fix me.
{
define("PAGE_NAME", "Password Reset");
}
define("LAN_02", "Sorry, unable to send email - please contact the main site administrator.");
define("LAN_03", "Password Reset");
@@ -15,7 +17,7 @@ define("LAN_06", "Attempted password reset");
define("LAN_07", "Someone with IP address ");
define("LAN_08", "attempted to reset the main admin password.");
define("LAN_09", "Password reset from ");
define("LAN_112", "Email address registered on this site");
// define("LAN_112", "Email address registered on this site"); // conflict removal.
// define("LAN_156", "Submit");
define("LAN_213", "That username/email address was not found in database.");
define("LAN_214", "Unable to reset password");
@@ -45,7 +47,7 @@ define("LAN_FPW18", "Password reset requested");
define("LAN_FPW19", "Email send failed");
define("LAN_FPW20", "Email send succeeded");
define("LAN_FPW21", "User clicked on password reset link");
define("LAN_FPW22", "Email address registered on this site");
define("LAN_FPW_100", "Forgot your password?");
define("LAN_FPW_101", "Not to worry. Just enter your email address below and we'll send you an email with instructions to get it back.");

View File

@@ -9,7 +9,10 @@
| $Author$
+----------------------------------------------------------------------------+
*/
define("PAGE_NAME", "Members Only");
if(!defined('PAGE_NAME'))
{
define("PAGE_NAME", "Members Only");
}
define("LAN_MEMBERS_0", "restricted area");
define("LAN_MEMBERS_1", "This is a restricted area.");

View File

@@ -5,8 +5,10 @@
* Language file - Search
*
*/
define("PAGE_NAME", "Search");
if(!defined('PAGE_NAME')) // TODO fix me
{
define("PAGE_NAME", "Search");
}
define("LAN_140", "Members");
// define("LAN_180", "Search");

View File

@@ -9,7 +9,10 @@
| $Author$
+----------------------------------------------------------------------------+
*/
define("PAGE_NAME", "User Posts");
if(!defined('PAGE_NAME'))
{
define("PAGE_NAME", "User Posts"); // todo fix me
}
define("UP_LAN_0", "All Forum Posts for [x]");
define("UP_LAN_1", "All Comments for [x]");

View File

@@ -133,7 +133,7 @@ define("LAN_401", "Leave blank to keep existing password");
define("LAN_404", "Please note: Any image uploaded to this server that is deemed inappropriate by the administrators will be deleted immediately.");
define("LAN_414", "Upload your photograph");
define("LAN_415", "Upload your avatar");
define("LAN_418", "Registration information");
// define("LAN_418", "Registration information");
define("LAN_420", "Avatar");
define("LAN_421", "Choose site-stored avatar");
define("LAN_422", "Use remote avatar");

View File

@@ -17,11 +17,12 @@ class e107Test extends \Codeception\Test\Unit
protected function _before()
{
try
{
$this->e107 = e107::getInstance();
}
catch (Exception $e)
catch(Exception $e)
{
$this->fail("Couldn't load e107 object");
}
@@ -31,6 +32,7 @@ class e107Test extends \Codeception\Test\Unit
public function testGetInstance()
{
// $this->e107->getInstance();
//$res = $this->e107::getInstance();
// $this->assertTrue($res);
@@ -38,10 +40,11 @@ class e107Test extends \Codeception\Test\Unit
public function testInitCore()
{
//$res = null;
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');
//$res = null;
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');
$res = $this->e107->initCore($e107_paths, e_ROOT, $sql_info, varset($E107_CONFIG, array()));
@@ -51,16 +54,17 @@ class e107Test extends \Codeception\Test\Unit
public function testRenderLayout()
{
$LAYOUT = file_get_contents(e_THEME."bootstrap3/theme.html");
$LAYOUT = file_get_contents(e_THEME . "bootstrap3/theme.html");
ob_start();
e107::renderLayout($LAYOUT);
$result = ob_get_clean();
$this->assertStringNotContainsString('{MENU=1}',$result);
$this->assertStringNotContainsString('{NAVIGATION=main}',$result);
$this->assertStringNotContainsString('{BOOTSTRAP_BRANDING}',$result);
$this->assertStringNotContainsString('{MENU=1}', $result);
$this->assertStringNotContainsString('{NAVIGATION=main}', $result);
$this->assertStringNotContainsString('{BOOTSTRAP_BRANDING}', $result);
}
@@ -301,11 +305,9 @@ class e107Test extends \Codeception\Test\Unit
}*/
public function testGetUserSession()
{
$tmp = e107::getUserSession();
$className = get_class($tmp);
@@ -315,6 +317,7 @@ class e107Test extends \Codeception\Test\Unit
$this->assertTrue($res);
}
/*
public function testGetSession()
{
@@ -461,260 +464,296 @@ class e107Test extends \Codeception\Test\Unit
}
*/
public function testGetHybridAuth()
public function testGetHybridAuth()
{
$object = e107::getHybridAuth();
$this->assertInstanceOf(Hybridauth\Hybridauth::class, $object);
}
/*
public function testGetUserClass()
{
$res = null;
$this->assertTrue($res);
}
public function testGetSystemUser()
{
$res = null;
$this->assertTrue($res);
}
public function testUser()
{
$res = null;
$this->assertTrue($res);
}
public function testSerialize()
{
$res = null;
$this->assertTrue($res);
}
public function testUnserialize()
{
$res = null;
$this->assertTrue($res);
}
public function testGetUser()
{
$res = null;
$this->assertTrue($res);
}
public function testGetModel()
{
$res = null;
$this->assertTrue($res);
}
public function testGetUserStructure()
{
$res = null;
$this->assertTrue($res);
}
public function testGetUserExt()
{
$res = null;
$this->assertTrue($res);
}
public function testGetUserPerms()
{
$res = null;
$this->assertTrue($res);
}
public function testGetRank()
{
$res = null;
$this->assertTrue($res);
}
public function testGetPlugin()
{
$res = null;
$this->assertTrue($res);
}
public function testGetPlug()
{
$res = null;
$this->assertTrue($res);
}
public function testGetOnline()
{
$res = null;
$this->assertTrue($res);
}
public function testGetChart()
{
$res = null;
$this->assertTrue($res);
}
public function testGetComment()
{
$res = null;
$this->assertTrue($res);
}
public function testGetCustomFields()
{
$res = null;
$this->assertTrue($res);
}
public function testGetMedia()
{
$res = null;
$this->assertTrue($res);
}
public function testGetNav()
{
$res = null;
$this->assertTrue($res);
}
public function testGetMessage()
{
$res = null;
$this->assertTrue($res);
}
public function testGetAjax()
{
$res = null;
$this->assertTrue($res);
}
public function testGetLibrary()
{
$res = null;
$this->assertTrue($res);
}
public function testLibrary()
{
$res = null;
$this->assertTrue($res);
}
public function testGetJs()
{
$res = null;
$this->assertTrue($res);
}
public function testSet()
{
$res = null;
$this->assertTrue($res);
}
public function testJs()
{
$res = null;
$this->assertTrue($res);
}
public function testLink()
{
}
public function testCss()
{
$res = null;
$this->assertTrue($res);
}
public function testDebug()
{
$res = null;
$this->assertTrue($res);
}
public function testGetJshelper()
{
$res = null;
$this->assertTrue($res);
}
public function testMeta()
{
$res = null;
$this->assertTrue($res);
}
public function testGetAdminUI()
{
$res = null;
$this->assertTrue($res);
}
public function testGetAddon()
{
$res = null;
$this->assertTrue($res);
}
public function testGetAddonConfig()
{
$res = null;
$this->assertTrue($res);
}
public function testCallMethod()
{
$res = null;
$this->assertTrue($res);
}
public function testGetUrlConfig()
{
$res = null;
$this->assertTrue($res);
}
public function testGetThemeInfo()
{
$res = null;
$this->assertTrue($res);
}
public function testCoreTemplatePath()
{
$res = null;
$this->assertTrue($res);
}
public function testTemplatePath()
{
$res = null;
$this->assertTrue($res);
}
*/
public function testGetCoreTemplate()
{
$templates = scandir(e_CORE."templates");
$e107 = $this->e107;
$exclude = array(
'admin_icons_template.php',
'admin_template.php',// FIXME - convert the template to v2.x standards.
'bbcode_template.php',
'online_template.php', // FIXME - convert the template to v2.x standards.
'sitedown_template.php', // FIXME - convert the template to v2.x standards.
);
foreach($templates as $file)
{
if(strpos($file,'_template.php') === false || in_array($file, $exclude))
{
$object = e107::getHybridAuth();
$this->assertInstanceOf(Hybridauth\Hybridauth::class, $object);
continue;
}
/*
public function testGetUserClass()
$path = str_replace('_template.php', '', $file);
e107::coreLan($path);
if($path === 'signup')
{
$res = null;
$this->assertTrue($res);
e107::coreLan('user');
}
public function testGetSystemUser()
{
$res = null;
$this->assertTrue($res);
}
$result = $e107::getCoreTemplate($path);
public function testUser()
{
$res = null;
$this->assertTrue($res);
}
$this->assertIsArray($result, $path." template was not an array");
$this->assertNotEmpty($result, $path." template was empty");
public function testSerialize()
{
$res = null;
$this->assertTrue($res);
}
}
public function testUnserialize()
{
$res = null;
$this->assertTrue($res);
}
//$res = null;
//$this->assertTrue($res);
}
public function testGetUser()
{
$res = null;
$this->assertTrue($res);
}
public function testGetModel()
{
$res = null;
$this->assertTrue($res);
}
public function testGetUserStructure()
{
$res = null;
$this->assertTrue($res);
}
public function testGetUserExt()
{
$res = null;
$this->assertTrue($res);
}
public function testGetUserPerms()
{
$res = null;
$this->assertTrue($res);
}
public function testGetRank()
{
$res = null;
$this->assertTrue($res);
}
public function testGetPlugin()
{
$res = null;
$this->assertTrue($res);
}
public function testGetPlug()
{
$res = null;
$this->assertTrue($res);
}
public function testGetOnline()
{
$res = null;
$this->assertTrue($res);
}
public function testGetChart()
{
$res = null;
$this->assertTrue($res);
}
public function testGetComment()
{
$res = null;
$this->assertTrue($res);
}
public function testGetCustomFields()
{
$res = null;
$this->assertTrue($res);
}
public function testGetMedia()
{
$res = null;
$this->assertTrue($res);
}
public function testGetNav()
{
$res = null;
$this->assertTrue($res);
}
public function testGetMessage()
{
$res = null;
$this->assertTrue($res);
}
public function testGetAjax()
{
$res = null;
$this->assertTrue($res);
}
public function testGetLibrary()
{
$res = null;
$this->assertTrue($res);
}
public function testLibrary()
{
$res = null;
$this->assertTrue($res);
}
public function testGetJs()
{
$res = null;
$this->assertTrue($res);
}
public function testSet()
{
$res = null;
$this->assertTrue($res);
}
public function testJs()
{
$res = null;
$this->assertTrue($res);
}
public function testLink()
{
}
public function testCss()
{
$res = null;
$this->assertTrue($res);
}
public function testDebug()
{
$res = null;
$this->assertTrue($res);
}
public function testGetJshelper()
{
$res = null;
$this->assertTrue($res);
}
public function testMeta()
{
$res = null;
$this->assertTrue($res);
}
public function testGetAdminUI()
{
$res = null;
$this->assertTrue($res);
}
public function testGetAddon()
{
$res = null;
$this->assertTrue($res);
}
public function testGetAddonConfig()
{
$res = null;
$this->assertTrue($res);
}
public function testCallMethod()
{
$res = null;
$this->assertTrue($res);
}
public function testGetUrlConfig()
{
$res = null;
$this->assertTrue($res);
}
public function testGetThemeInfo()
{
$res = null;
$this->assertTrue($res);
}
public function testCoreTemplatePath()
{
$res = null;
$this->assertTrue($res);
}
public function testTemplatePath()
{
$res = null;
$this->assertTrue($res);
}
public function testGetCoreTemplate()
{
$res = null;
$this->assertTrue($res);
}
*/
/**
* This test checks getTemplate() use on loading between the core download plugin template and the _blank theme download template
*/
public function testGetTemplate()
{
e107::getConfig()->set('sitetheme', '_blank');
require_once(e_PLUGIN."download/languages/English/English_front.php"); // LANS in template files.
require_once(e_PLUGIN . "download/languages/English/English_front.php"); // LANS in template files.
$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).
@@ -739,6 +778,7 @@ class e107Test extends \Codeception\Test\Unit
}
/*
public function testTemplateWrapper()
{
@@ -782,74 +822,77 @@ class e107Test extends \Codeception\Test\Unit
$this->assertTrue($res);
}
*/
public function testPlugLan()
{
// Make sure nothing else loaded the language files.
$this->assertFalse(defined('BANNERLAN_19'), 'BANNERLAN_19 is already defined!');
// $this->assertFalse(defined('LAN_FORUM_0002'), 'LAN_FORUM_0002 is already defined!');
$this->assertFalse(defined('LAN_GALLERY_ADMIN_01'), 'LAN_GALLERY_ADMIN_01 is already defined!');
$this->assertFalse(defined('CM_L1'), 'Comment Menu English file already defined');
$this->assertFalse(defined('LAN_FORUM_MENU_001'),'LAN_FORUM_MENU_001 is already defined!');
$this->assertFalse(defined('BNRLAN_11'),'BNRLAN_11 is already defined!');
$this->assertFalse(defined('CHATBOX_L1'),'CHATBOX_L1 is already defined!');
public function testPlugLan()
{
$this->assertTrue(defined('LAN_PLUGIN_GALLERY_SEF_01')); // global so it is defined already.
// Make sure nothing else loaded the language files.
$this->assertFalse(defined('BANNERLAN_19'), 'BANNERLAN_19 is already defined!');
// $this->assertFalse(defined('LAN_FORUM_0002'), 'LAN_FORUM_0002 is already defined!');
$this->assertFalse(defined('LAN_GALLERY_ADMIN_01'), 'LAN_GALLERY_ADMIN_01 is already defined!');
$this->assertFalse(defined('CM_L1'), 'Comment Menu English file already defined');
$this->assertFalse(defined('LAN_FORUM_MENU_001'), 'LAN_FORUM_MENU_001 is already defined!');
$this->assertFalse(defined('BNRLAN_11'), 'BNRLAN_11 is already defined!');
$this->assertFalse(defined('CHATBOX_L1'), 'CHATBOX_L1 is already defined!');
$e107 = $this->e107;
$this->assertTrue(defined('LAN_PLUGIN_GALLERY_SEF_01')); // global so it is defined already.
// Test 1
$e107::plugLan('banner'); // languages/English_front.php
$this->assertTrue(defined('BANNERLAN_19'), 'plugLan() test #1 failed');
$e107 = $this->e107;
// Test 2 - conflict with shortcode testing.
// $e107::plugLan('forum', 'front', true); // languages/English/English_front.php
// $this->assertTrue(defined('LAN_FORUM_0002'),'plugLan() test #2 failed');
// Test 1
$e107::plugLan('banner'); // languages/English_front.php
$this->assertTrue(defined('BANNERLAN_19'), 'plugLan() test #1 failed');
// Test 3
$e107::plugLan('gallery', true, true); // languages/English/English_admin.php
$this->assertTrue(defined('LAN_GALLERY_ADMIN_01'),'plugLan() test #3 failed');
// Test 2 - conflict with shortcode testing.
// $e107::plugLan('forum', 'front', true); // languages/English/English_front.php
// $this->assertTrue(defined('LAN_FORUM_0002'),'plugLan() test #2 failed');
// Test 4
$e107::plugLan('forum','menu', true); // languages/English/English_menu.php
$this->assertTrue(defined('LAN_FORUM_MENU_001'),'plugLan() test #4 failed');
// Test 3
$e107::plugLan('gallery', true, true); // languages/English/English_admin.php
$this->assertTrue(defined('LAN_GALLERY_ADMIN_01'), 'plugLan() test #3 failed');
// Test 5
$e107::plugLan('banner', true); // languages/English_admin.php
$this->assertTrue(defined('BNRLAN_11'),'plugLan() test #5 failed');
// Test 4
$e107::plugLan('forum', 'menu', true); // languages/English/English_menu.php
$this->assertTrue(defined('LAN_FORUM_MENU_001'), 'plugLan() test #4 failed');
// Test 6
$e107::plugLan('chatbox_menu', e_LANGUAGE); // languages/English/English.php
$this->assertTrue(defined('CHATBOX_L1'),'plugLan() test #6 failed');
// Test 5
$e107::plugLan('banner', true); // languages/English_admin.php
$this->assertTrue(defined('BNRLAN_11'), 'plugLan() test #5 failed');
// Test 7
$e107::plugLan('comment_menu', null); // languages/English.php - BC path.
$this->assertTrue(defined('CM_L1'), 'plugLan() test #7 failed');
// Test 6
$e107::plugLan('chatbox_menu', e_LANGUAGE); // languages/English/English.php
$this->assertTrue(defined('CHATBOX_L1'), 'plugLan() test #6 failed');
}
/*
public function testThemeLan()
{
$res = null;
$this->assertTrue($res);
}
// Test 7
$e107::plugLan('comment_menu', null); // languages/English.php - BC path.
$this->assertTrue(defined('CM_L1'), 'plugLan() test #7 failed');
public function testLan()
{
$res = null;
$this->assertTrue($res);
}
}
public function testPref()
{
$res = null;
$this->assertTrue($res);
}
*/
/*
public function testThemeLan()
{
$res = null;
$this->assertTrue($res);
}
public function testLan()
{
$res = null;
$this->assertTrue($res);
}
public function testPref()
{
$res = null;
$this->assertTrue($res);
}
*/
public function testUrl()
{
$obj = $this->e107;
$result = $obj::url('news','index', array(), array('mode'=>'full'));
$result = $obj::url('news', 'index', array(), array('mode' => 'full'));
$this->assertEquals("https://localhost/e107/news", $result);
}
@@ -859,11 +902,12 @@ class e107Test extends \Codeception\Test\Unit
*/
public function testUrlOptionQueryHasCompliantAmpersand()
{
$e107 = $this->e107;
$e107::getPlugin()->install('forum');
$url = $e107::url('forum', 'topic', [], array(
'query' => array(
'f' => 'post',
'f' => 'post',
'id' => 123
),
));
@@ -876,12 +920,13 @@ class e107Test extends \Codeception\Test\Unit
public function testUrlOptionQueryUrlEncoded()
{
$e107 = $this->e107;
$e107::getPlugin()->install('forum');
$url = $e107::url('forum', 'post', [], array(
'query' => array(
"didn't" => '<tag attr="such wow"></tag>',
'did' => 'much doge',
'did' => 'much doge',
),
));
$this->assertEquals(
@@ -894,6 +939,7 @@ class e107Test extends \Codeception\Test\Unit
public function testUrlEscapesHtmlSpecialChars()
{
$e107 = $this->e107;
$e107::getPlugin()->install('forum');
$url = $e107::url('forum', 'forum', [
@@ -908,6 +954,7 @@ class e107Test extends \Codeception\Test\Unit
);
}
/*
public function testRedirect()
{
@@ -927,64 +974,66 @@ class e107Test extends \Codeception\Test\Unit
$this->assertTrue($res);
}
*/
public function testMinify()
{
$text = "something ; other or ; else";
$expected = "something;other or;else";
public function testMinify()
{
$result = e107::minify($text);
$text = "something ; other or ; else";
$expected = "something;other or;else";
$this->assertEquals($expected,$result);
$result = e107::minify($text);
}
$this->assertEquals($expected, $result);
public function testWysiwyg()
{
e107::getConfig()->setPref('wysiwyg', true)->save();
$tinyMceInstalled = e107::isInstalled('tinymce4');
}
$tests = array(
//input => expected
'default' => ($tinyMceInstalled) ? 'tinymce4' : 'bbcode',
'bbcode' => 'bbcode',
'tinymce4' => ($tinyMceInstalled) ? 'tinymce4' : 'bbcode',
);
public function testWysiwyg()
{
foreach($tests as $input => $expected)
e107::getConfig()->setPref('wysiwyg', true)->save();
$tinyMceInstalled = e107::isInstalled('tinymce4');
$tests = array(
//input => expected
'default' => ($tinyMceInstalled) ? 'tinymce4' : 'bbcode',
'bbcode' => 'bbcode',
'tinymce4' => ($tinyMceInstalled) ? 'tinymce4' : 'bbcode',
);
foreach($tests as $input => $expected)
{
e107::wysiwyg($input); // set the wysiwyg editor.
$result = e107::wysiwyg(null, true); // get the name of the editor.
$this->assertSame($expected, $result, "Input: " . $input);
}
e107::getConfig()->setPref('wysiwyg', false)->save(); // wysiwyg is disabled.
e107::wysiwyg('default'); // set as default.
$result = e107::wysiwyg(null, true); // get the editor value.
$expected = 'bbcode';
e107::getConfig()->setPref('wysiwyg', true)->save(); // enabled wysiwyg again.
$this->assertSame($expected, $result);
}
/*
public function testLoadLanFiles()
{
e107::wysiwyg($input); // set the wysiwyg editor.
$result = e107::wysiwyg(null, true); // get the name of the editor.
$this->assertSame($expected, $result, "Input: ".$input);
$res = null;
$this->assertTrue($res);
}
e107::getConfig()->setPref('wysiwyg', false)->save(); // wysiwyg is disabled.
e107::wysiwyg('default'); // set as default.
$result = e107::wysiwyg(null, true); // get the editor value.
$expected = 'bbcode';
e107::getConfig()->setPref('wysiwyg', true)->save(); // enabled wysiwyg again.
$this->assertSame($expected, $result);
}
/*
public function testLoadLanFiles()
{
$res = null;
$this->assertTrue($res);
}
public function testPrepare_request()
{
$res = null;
$this->assertTrue($res);
}
*/
public function testPrepare_request()
{
$res = null;
$this->assertTrue($res);
}
*/
public function testBase64DecodeOnAjaxURL()
{
$query = "mode=main&iframe=1&action=info&src=aWQ9ODgzJnVybD1odHRwcyUzQSUyRiUyRmUxMDcub3JnJTJGZTEwN19wbHVnaW5zJTJGYWRkb25zJTJGYWRkb25zLnBocCUzRmlkJTNEODgzJTI2YW1wJTNCbW9kYWwlM0QxJm1vZGU9YWRkb24mcHJpY2U9";
$result = base64_decode($query, true);
@@ -995,42 +1044,41 @@ class e107Test extends \Codeception\Test\Unit
public function testInAdminDir()
{
$tests = array(
0 => array('path' => 'thumb.php', 'plugdir' => false, 'expected' => false),
1 => array('path' => 'index.php', 'plugdir' => false, 'expected' => false),
2 => array('path' => 'e107_admin/prefs.php', 'plugdir' => false, 'expected' => true),
3 => array('path' => 'e107_admin/menus.php', 'plugdir' => false, 'expected' => true),
4 => array('path' => 'e107_plugins/forum/forum.php', 'plugdir' => true, 'expected' => false),
5 => array('path' => 'e107_plugins/vstore/admin_config.php', 'plugdir' => true, 'expected' => true),
6 => array('path' => 'e107_plugins/login_menu/config.php', 'plugdir' => true, 'expected' => true),
7 => array('path' => 'e107_plugins/myplugin/prefs.php', 'plugdir' => true, 'expected' => true),
8 => array('path' => 'e107_plugins/dtree_menu/dtree_config.php', 'plugdir' => true, 'expected' => true),
9 => array('path' => 'e107_plugins/myplugin/admin/something.php', 'plugdir' => true, 'expected' => true),
10 => array('path' => 'e107_plugins/myplugin/bla_admin.php', 'plugdir' => true, 'expected' => true),
11 => array('path' => 'e107_plugins/myplugin/admin_xxx.php', 'plugdir' => true, 'expected' => true),
0 => array('path' => 'thumb.php', 'plugdir' => false, 'expected' => false),
1 => array('path' => 'index.php', 'plugdir' => false, 'expected' => false),
2 => array('path' => 'e107_admin/prefs.php', 'plugdir' => false, 'expected' => true),
3 => array('path' => 'e107_admin/menus.php', 'plugdir' => false, 'expected' => true),
4 => array('path' => 'e107_plugins/forum/forum.php', 'plugdir' => true, 'expected' => false),
5 => array('path' => 'e107_plugins/vstore/admin_config.php', 'plugdir' => true, 'expected' => true),
6 => array('path' => 'e107_plugins/login_menu/config.php', 'plugdir' => true, 'expected' => true),
7 => array('path' => 'e107_plugins/myplugin/prefs.php', 'plugdir' => true, 'expected' => true),
8 => array('path' => 'e107_plugins/dtree_menu/dtree_config.php', 'plugdir' => true, 'expected' => true),
9 => array('path' => 'e107_plugins/myplugin/admin/something.php', 'plugdir' => true, 'expected' => true),
10 => array('path' => 'e107_plugins/myplugin/bla_admin.php', 'plugdir' => true, 'expected' => true),
11 => array('path' => 'e107_plugins/myplugin/admin_xxx.php', 'plugdir' => true, 'expected' => true),
);
foreach($tests as $index=>$var)
foreach($tests as $index => $var)
{
$curPage = basename($var['path']);
$result = $this->e107->inAdminDir($var['path'], $curPage, $var['plugdir']);
$this->assertSame($var['expected'], $result, "Failed on index #".$index);
$this->assertSame($var['expected'], $result, "Failed on index #" . $index);
}
// Test legacy override.
$GLOBALS['eplug_admin'] = true;
$result = $this->e107->inAdminDir('myplugin.php','myplugin.php', true);
$result = $this->e107->inAdminDir('myplugin.php', 'myplugin.php', true);
$this->assertTrue($result, "Legacy Override Failed");
// Test legacy off.
$GLOBALS['eplug_admin'] = false;
$result = $this->e107->inAdminDir('myplugin.php','myplugin.php', true);
$result = $this->e107->inAdminDir('myplugin.php', 'myplugin.php', true);
$this->assertFalse($result);
}
public function testFilter_request()
{
@@ -1047,6 +1095,7 @@ class e107Test extends \Codeception\Test\Unit
// $res = null;
// $this->assertTrue($res);
}
/*
public function testSet_base_path()
{
@@ -1146,6 +1195,7 @@ class e107Test extends \Codeception\Test\Unit
*/
public function testIsInstalled()
{
$obj = $this->e107;
$result = $obj::isInstalled('user');

View File

@@ -191,6 +191,8 @@
*/
public function testUserExtendedShortcode()
{
e107::setRegistry('corelan/English_user_extended_front');
foreach($this->userValues as $field => $value)
{
$this->ue->set(1, $field, $value); // set user extended value for user_id: 1.

View File

@@ -419,34 +419,37 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
$this->fail($e->getMessage());
}
$vars = array('page_id' => '1',
'page_title' => 'Article 1',
'page_subtitle' => 'My subtitle goes here.',
'page_sef' => 'article-1',
'page_chapter' => '2',
'page_metakeys' => 'keywords',
'page_metadscr' => 'Meta Description',
'page_metarobots' => 'noindex',
'page_text' => '[html]<p>Lorem ipsum dolor sit amet, <sup>1</sup> consectetur adipiscing elit. Donec libero ipsum; imperdiet at risus non, dictum sagittis odio! Nulla facilisi. Pellentesque adipiscing facilisis pharetra. Morbi imperdiet augue in ligula luctus, et iaculis est porttitor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In ultricies vitae nisi ut porttitor. Curabitur lectus tellus, feugiat a elit vel, gravida iaculis dui. Nulla vulputate turpis dui, ac faucibus enim dignissim non. Ut non tellus suscipit, scelerisque orci sed, scelerisque sapien. Aenean convallis sodales nulla in porttitor. In pretium ante sapien, a tempor eros blandit nec <sup>2</sup>.<br><br>Nulla non est nibh? Fusce lacinia quam adipiscing magna posuere dapibus. Sed mollis condimentum rhoncus. Morbi sollicitudin tellus a ligula luctus, ac varius arcu ullamcorper. Mauris in aliquet tellus, nec porttitor dui. Quisque interdum euismod mi sed bibendum. Vivamus non odio quis quam lacinia rhoncus in nec nibh. Integer vitae turpis condimentum, laoreet diam nec viverra fusce.</p>[/html]',
'page_author' => '1',
'page_datestamp' => '1371420000',
'page_rating_flag' => '1',
$sc->__construct();
$vars = array(
'page_id' => '1',
'page_title' => 'Article 1',
'page_subtitle' => 'My subtitle goes here.',
'page_sef' => 'article-1',
'page_chapter' => '2',
'page_metakeys' => 'keywords',
'page_metadscr' => 'Meta Description',
'page_metarobots' => 'noindex',
'page_text' => '[html]<p>Lorem ipsum dolor sit amet, <sup>1</sup> consectetur adipiscing elit. Donec libero ipsum; imperdiet at risus non.</p>[/html]',
'page_author' => '1',
'page_datestamp' => '1371420000',
'page_rating_flag' => '1',
'page_comment_flag' => '1',
'page_password' => '',
'page_class' => '0',
'page_ip_restrict' => '',
'page_template' => 'default',
'page_order' => '20',
'page_fields' => NULL,'menu_name' => '',
'menu_title' => 'Heading 1',
'menu_text' => '[html]<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus auctor egestas condimentum. Suspendisse placerat nunc orci, a ultrices tortor eleifend in. Vestibulum tincidunt fringilla malesuada? Phasellus dolor risus, aliquam eu odio quis, mattis cursus magna. Integer ut blandit purus; vitae posuere ante. Vivamus sapien nisl, pulvinar vel turpis a, malesuada vehicula lorem! Curabitur magna justo; laoreet at congue sit amet, tincidunt sit amet erat. Integer vehicula eros quis odio tincidunt, nec dapibus sem molestie. Cras sed viverra eros. Nulla ut lectus tellus.</p>[/html]',
'menu_image' => '{e_THEME}steminst_eu/_content/2019-07/chromosome_dna_pattern_genetic_3_d_psychedelic_1920x1200.jpg',
'menu_icon' => '',
'menu_template' => 'button',
'menu_class' => '0',
'menu_button_url' => '',
'menu_button_text' => '')
;
'page_password' => '',
'page_class' => '0',
'page_ip_restrict' => '',
'page_template' => 'default',
'page_order' => '20',
'page_fields' => NULL,'menu_name' => '',
'menu_title' => 'Heading 1',
'menu_text' => '[html]<p>Lorem ipsum dolor sit amet. Suspendisse placerat nunc orci, lectus tellus.</p>[/html]',
'menu_image' => '{e_THEME}myimage.jpg',
'menu_icon' => '',
'menu_template' => 'button',
'menu_class' => '0',
'menu_button_url' => '',
'menu_button_text' => ''
);
$sc->setVars($vars);
@@ -853,6 +856,14 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
}
public function testFpwShortcodes() // todo move fpw shortcodes out of fpw.php to its own file.
{
}
public function testForumShortcodes()
{

View File

@@ -131,6 +131,8 @@ if ($pref['membersonly_enabled'])
}
else
{
$oldDefs = array('LAN_112' => 'LAN_FPW22');
e107::getLanguage()->bcDefs($oldDefs);
require_once (e107::coreTemplatePath('fpw')); //correct way to load a core template.
}

View File

@@ -88,6 +88,9 @@ class usersettings_front // Begin Usersettings rewrite.
}
else
{
$bcDefs = array('LAN_418'=>'LAN_USET_31');
e107::getLanguage()->bcDefs($bcDefs);
global $sc_style;
$REQUIRED_FIELD = '';
$USER_EXTENDED_CAT = '';