mirror of
https://github.com/e107inc/e107.git
synced 2025-08-16 11:36:08 +02:00
CoreTemplate tests. FPW BC constant fix.
This commit is contained in:
@@ -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');
|
||||
|
@@ -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.
|
||||
|
@@ -418,35 +418,38 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
||||
{
|
||||
$this->fail($e->getMessage());
|
||||
}
|
||||
|
||||
$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, 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',
|
||||
$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()
|
||||
{
|
||||
|
Reference in New Issue
Block a user