1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 06:38:00 +02:00
This commit is contained in:
Cameron
2021-04-06 18:41:15 -07:00
parent 920a881898
commit 2862e18db9
6 changed files with 806 additions and 624 deletions

View File

@@ -1667,14 +1667,28 @@ class media_admin_ui extends e_admin_ui
private function mediaManagerPlaceholders()
{
$type = (E107_DEBUG_LEVEL > 0) ? 'text' : 'hidden';
$br = (E107_DEBUG_LEVEL > 0) ? "<br style='clear:both' />" : '';
$text = '
' .$br."<input title='bbcode' type='{$type}' style=readonly='readonly' class='span11 col-md-11' id='bbcode_holder' name='bbcode_holder' value='' />
".$br."<input title='html/wysiwyg' type='{$type}' class='span11 col-md-11' readonly='readonly' id='html_holder' name='html_holder' value='' />
".$br."<input title='(preview) src' type='{$type}' class='span11 col-md-11' readonly='readonly' id='src' name='src' value='' />
".$br."<input title='path (saved to db)' type='{$type}' class='span11 col-md-11' readonly='readonly' id='path' name='path' value='' />
";
$valueHolders = [
'bbcode_holder' => 'bbcode',
'html_holder' => 'html/wysiwyg',
'src' => '(preview) src',
'path' => 'path (save to db)'
];
$text = '';
foreach($valueHolders as $name => $label)
{
$text .= (E107_DEBUG_LEVEL > 0) ? "<br /><span style='margin-left:20px;display:inline-block;width:150px'>".$label."&nbsp;</span>" : '';
$text .= "<input title='".$label."' type='{$type}' readonly style='width:800px' class='' id='".$name."' name='".$name."' value='' />\n";
}
if(E107_DEBUG_LEVEL > 0)
{
$text .= "<br /><span style='margin-left:20px;display:inline-block;width:150px'>FontAwesome</span>".e107::getTheme()->getFontAwesome();
}
return $text;
}
@@ -2117,12 +2131,15 @@ class media_admin_ui extends e_admin_ui
}
if($this->fontawesome === 4)
{
e107::getParser()->setFontAwesome(4);;
$fa4 = e107::getMedia()->getGlyphs('fa4');
foreach($fa4 as $val)
{
$items[] = array(
'previewHtml' => $md->previewTag('fa-'.$val,array('type'=>'glyph')),
'previewHtml' => $md->previewTag('fa-'.$val, array('type'=>'glyph')),
'previewUrl' => 'fa fa-'.$val,
'saveValue' => 'fa-'.$val.'.glyph',
'thumbUrl' => 'fa-'.$val,
@@ -2131,7 +2148,7 @@ class media_admin_ui extends e_admin_ui
'slideCategory' => 'font-awesome'
);
}
}
if($this->fontawesome === false || ($this->fontawesome < 4))
{

View File

@@ -1103,6 +1103,15 @@ class e_theme
unset($vars['libraries']);
}
else // detect defined constants in legacy theme.php file.
{
if($data = self::getLegacyBSFA($path))
{
$vars['library'] = $data;
}
}
if(!empty($vars['stylesheets']['css']))
{
@@ -1158,6 +1167,37 @@ class e_theme
return $vars;
}
/**
* Read legacy bootstrap/fontawesome constants from theme.php
* @param string $path theme directory
*/
public static function getLegacyBSFA($path)
{
if(!$content = file_get_contents(e_THEME.$path.'/theme.php'))
{
return false;
}
$ret = [];
if(preg_match('/define[ ]*?\([\'|"]BOOTSTRAP[\'|"],[ \t]*(\d)\);/', $content, $m))
{
$ret[] = array('name' => 'bootstrap',
'version' => $m[1],
'scope' => 'front,wysiwyg',
);
}
if(preg_match('/define[ ]*?\([\'|"]FONTAWESOME[\'|"],[ \t]*(\d)\);/', $content, $m))
{
$ret[] = array('name' => 'fontawesome',
'version' => $m[1],
'scope' => 'front,wysiwyg',
);
}
return $ret;
}
/**
* Validate and return the name of the categories.

View File

@@ -114,7 +114,9 @@ TEMPL;
public function toHTML($content)
{
$tp = e107::getParser();
// XXX @Cam possible fix - convert to BB first, see news admin AJAX request/response values for reference why
$fa = e107::getTheme()->getFontAwesome(); // get the frontend theme's fontawesome version.
$tp->setFontAwesome($fa);
$content = stripslashes($content);
// $content = e107::getBB()->htmltoBBcode($content); //XXX This breaks inserted images from media-manager. :/

View File

@@ -943,12 +943,12 @@ class wysiwyg
/**
* @return array
*/
public function getEditorCSS()
public function getEditorCSS($theme = 'front')
{
$tp = e107::getParser();
$libraries = e107::getTheme('admin')->getThemeFiles('library', 'wysiwyg');
$libraries = e107::getTheme($theme)->getThemeFiles('library', 'wysiwyg');
$ret = [];
@@ -967,7 +967,7 @@ class wysiwyg
if($useThemeStyle)
{
$theme = e107::getTheme()->getThemeFiles('css', 'wysiwyg');
$theme = e107::getTheme($theme)->getThemeFiles('css', 'wysiwyg');
if(!empty($theme['css']))
{
foreach($theme['css'] as $path)

View File

@@ -1,5 +1,5 @@
<?php
/**
/**
* Created by PhpStorm.
* User: Wiz
* Date: 1/24/2019
@@ -7,21 +7,21 @@
*/
class e_themeTest extends \Codeception\Test\Unit
{
class e_themeTest extends \Codeception\Test\Unit
{
/** @var e_theme */
private $tm;
protected function _before()
{
// require_once(e_HANDLER."e_marketplace.php");
try
{
$this->tm = $this->make('e_theme');
}
catch (Exception $e)
catch(Exception $e)
{
$this->assertTrue(false, "Couldn't load e_theme object");
}
@@ -31,7 +31,7 @@
}
/*
/*
public function testCssAttribute()
{
@@ -46,22 +46,23 @@
{
}
*/
*/
public function testGetScope()
{
$tests = array(
0 => array(
'theme' => 'front',
'type' => 'library',
'scope' => 'front',
'expected' => array (
'expected' => array(
'bootstrap' =>
array (
array(
'name' => 'bootstrap',
'version' => '3',
),
'fontawesome' =>
array (
array(
'name' => 'fontawesome',
'version' => '5',
),
@@ -71,19 +72,19 @@
'theme' => 'front',
'type' => 'library',
'scope' => 'all',
'expected' => array (
'expected' => array(
'bootstrap' =>
array (
array(
'name' => 'bootstrap',
'version' => '3',
),
'fontawesome' =>
array (
array(
'name' => 'fontawesome',
'version' => '5',
),
'bootstrap.editable' =>
array (
array(
'name' => 'bootstrap.editable',
'version' => '',
),
@@ -93,19 +94,19 @@
'theme' => 'front',
'type' => 'library',
'scope' => 'admin',
'expected' => array (
'expected' => array(
'bootstrap' =>
array (
array(
'name' => 'bootstrap',
'version' => '3',
),
'fontawesome' =>
array (
array(
'name' => 'fontawesome',
'version' => '5',
),
'bootstrap.editable' =>
array (
array(
'name' => 'bootstrap.editable',
'version' => '',
),
@@ -115,14 +116,14 @@
'theme' => '_blank',
'type' => 'library',
'scope' => 'front',
'expected' => array (
'expected' => array(
'bootstrap' =>
array (
array(
'name' => 'bootstrap',
'version' => '3',
),
'fontawesome' =>
array (
array(
'name' => 'fontawesome',
'version' => '4',
),
@@ -132,9 +133,9 @@
'theme' => 'bootstrap3',
'type' => 'css',
'scope' => 'front',
'expected' => array (
'expected' => array(
'style.css' =>
array (
array(
'name' => 'style.css',
'info' => 'Default',
'nonadmin' => true,
@@ -142,7 +143,7 @@
'description' => '',
'thumbnail' => '',
),
'*' => array (
'*' => array(
'name' => '*',
'info' => '*',
'nonadmin' => true,
@@ -156,9 +157,9 @@
'theme' => 'bootstrap3',
'type' => 'css',
'scope' => 'admin',
'expected' => array (
'expected' => array(
'css/modern-light.css' =>
array (
array(
'name' => 'css/modern-light.css',
'info' => 'Modern Light',
'nonadmin' => false,
@@ -167,7 +168,7 @@
'thumbnail' => 'images/admin_modern-light.webp',
),
'css/modern-dark.css' =>
array (
array(
'name' => 'css/modern-dark.css',
'info' => 'Modern Dark',
'nonadmin' => false,
@@ -176,7 +177,7 @@
'thumbnail' => 'images/admin_modern-dark.webp',
),
'css/bootstrap-dark.min.css' =>
array (
array(
'name' => 'css/bootstrap-dark.min.css',
'info' => 'Legacy Dark Admin',
'nonadmin' => false,
@@ -185,7 +186,7 @@
'thumbnail' => 'images/admin_bootstrap-dark.webp',
),
'css/kadmin.css' =>
array (
array(
'name' => 'css/kadmin.css',
'info' => 'K-Admin Inspired',
'nonadmin' => false,
@@ -194,7 +195,7 @@
'thumbnail' => 'images/admin_kadmin.webp',
),
'css/corporate.css' =>
array (
array(
'name' => 'css/corporate.css',
'info' => 'Corporate',
'nonadmin' => false,
@@ -203,7 +204,7 @@
'thumbnail' => 'images/admin_corporate.webp',
),
'https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/flatly/bootstrap.min.css' =>
array (
array(
'name' => 'https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/flatly/bootstrap.min.css',
'info' => 'Flatly',
'nonadmin' => false,
@@ -212,7 +213,7 @@
'thumbnail' => 'images/admin_flatly.webp',
),
'https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/sandstone/bootstrap.min.css' =>
array (
array(
'name' => 'https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/sandstone/bootstrap.min.css',
'info' => 'Sandstone',
'nonadmin' => false,
@@ -221,7 +222,7 @@
'thumbnail' => 'images/admin_sandstone.webp',
),
'https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/superhero/bootstrap.min.css' =>
array (
array(
'name' => 'https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/superhero/bootstrap.min.css',
'info' => 'Superhero',
'nonadmin' => false,
@@ -242,7 +243,7 @@
var_export($result);
continue;
}
$this->assertSame($var['expected'], $result, 'Test #'.$index.' failed.');
$this->assertSame($var['expected'], $result, 'Test #' . $index . ' failed.');
}
@@ -252,22 +253,22 @@
public function testGetThemeFiles()
{
$expected = array (
$expected = array(
0 =>
array (
array(
'css' =>
array (
array(
0 => '{e_WEB}lib/bootstrap/3/css/bootstrap.min.css',
),
'js' =>
array (
array(
0 => '{e_WEB}lib/bootstrap/3/js/bootstrap.min.js',
),
),
1 =>
array (
array(
'css' =>
array (
array(
0 => '{e_WEB}lib/font-awesome/5/css/all.min.css',
1 => '{e_WEB}lib/font-awesome/5/css/v4-shims.min.css',
),
@@ -279,22 +280,22 @@
$this->assertSame($expected, $result);
$expected = array (
$expected = array(
0 =>
array (
array(
'css' =>
array (
array(
0 => '{e_WEB}lib/bootstrap/3/css/bootstrap.min.css',
),
'js' =>
array (
array(
0 => '{e_WEB}lib/bootstrap/3/js/bootstrap.min.js',
),
),
1 =>
array (
array(
'css' =>
array (
array(
0 => '{e_WEB}lib/font-awesome/5/css/all.min.css',
1 => '{e_WEB}lib/font-awesome/5/css/v4-shims.min.css',
),
@@ -304,10 +305,9 @@
$result = e107::getTheme('bootstrap3')->getThemeFiles('library', 'wysiwyg');
$this->assertSame($expected, $result);
$expected = array (
$expected = array(
'css' =>
array (
),
array(),
);
$result = e107::getTheme('bootstrap3')->getThemeFiles('css', 'wysiwyg');
@@ -318,9 +318,9 @@
}
public function testLoadLibrary()
{
$tests = array(
0 => array(
'theme' => 'front',
@@ -343,37 +343,36 @@
foreach($tests as $index => $var)
{
$loaded = e107::getTheme($var['theme'])->loadLibrary($var['scope']);
$this->assertSame($var['expected'], $loaded, 'Test #'.$index.' failed.');
$this->assertSame($var['expected'], $loaded, 'Test #' . $index . ' failed.');
}
// var_export($loaded);
}
public function testGet()
{
$tests = array(
0 => array(
'theme' => 'front',
'type' => 'library',
'expected' => array (
'expected' => array(
0 =>
array (
array(
'name' => 'bootstrap',
'version' => '3',
'scope' => 'front,admin,wysiwyg',
),
1 =>
array (
array(
'name' => 'fontawesome',
'version' => '5',
'scope' => 'front,admin,wysiwyg',
),
2 =>
array (
array(
'name' => 'bootstrap.editable',
'version' => '',
'scope' => 'admin',
@@ -383,21 +382,21 @@
1 => array(
'theme' => 'bootstrap3',
'type' => 'library',
'expected' => array (
'expected' => array(
0 =>
array (
array(
'name' => 'bootstrap',
'version' => '3',
'scope' => 'front,admin,wysiwyg',
),
1 =>
array (
array(
'name' => 'fontawesome',
'version' => '5',
'scope' => 'front,admin,wysiwyg',
),
2 =>
array (
array(
'name' => 'bootstrap.editable',
'version' => '',
'scope' => 'admin',
@@ -407,15 +406,15 @@
2 => array(
'theme' => '_blank',
'type' => 'library',
'expected' => array (
'expected' => array(
0 =>
array (
array(
'name' => 'bootstrap',
'version' => '3',
'scope' => 'front',
),
1 =>
array (
array(
'name' => 'fontawesome',
'version' => '4',
'scope' => 'front',
@@ -429,12 +428,13 @@
foreach($tests as $index => $var)
{
$result = e107::getTheme($var['theme'])->get($var['type']);
$this->assertSame($var['expected'], $result, 'Test #'.$index.' failed');
$this->assertSame($var['expected'], $result, 'Test #' . $index . ' failed');
}
}
/*
/*
public function testParse_theme_php()
{
@@ -448,16 +448,16 @@
public function testGetThemeLayout()
{
$pref = array (
$pref = array(
'jumbotron_home' =>
array (
array(
0 => 'FRONTPAGE',
1 => 'page.php?3!',
2 => '/my-sef-url!',
3 => '/news/?page=',
),
'jumbotron_full' =>
array (
array(
0 => 'forum',
1 => 'user.php!', // <-- exact match of URL
2 => ':forum/index',
@@ -466,7 +466,7 @@
// 2 => '/user', // <-- Expecting URL to match both user and usersetting since it contains no "!"
),
'jumbotron_sidebar_right' =>
array (
array(
0 => '/news',
1 => '/user/',
2 => 'user.php?id',
@@ -493,47 +493,47 @@
$tests = array(
0 => array('url' => SITEURL."index.php", 'expected' => 'jumbotron_home'),
1 => array('url' => SITEURL."index.php?", 'expected' => 'jumbotron_home'),
2 => array('url' => SITEURL."index.php?fbclid=asdlkjasdlakjsdasd", 'expected' => 'jumbotron_home'),
3 => array('url' => SITEURL."index.php?utm_source=asdd&utm_medium=asdsd", 'expected' => 'jumbotron_home'),
4 => array('url' => SITEURL."news", 'expected' => 'jumbotron_sidebar_right'),
5 => array('url' => SITEURL."forum", 'script' => "/forum/index.php", 'expected' => 'jumbotron_full'),
6 => array('url' => SITEURL."other/page", 'script' => '/page.php', 'expected' => 'other_layout'),
7 => array('url' => SITEURL."news.php?5.3", 'script' => '/news.php', 'expected' => 'jumbotron_sidebar_right'),
8 => array('url' => SITEURL."usersettings.php", 'script' => '/usersettings.php', 'expected' => 'jumbotron_sidebar_right'),
9 => array('url' => SITEURL."user.php", 'script' => '/user.php', 'expected' => 'jumbotron_full'),
10 => array('url' => SITEURL."page.php", 'script' => '/page.php', 'expected' => 'other_layout'),
11 => array('url' => SITEURL."page.php?3", 'script' => '/page.php', 'expected' => 'jumbotron_home'),
12 => array('url' => SITEURL."somepage/", 'script' => "/script.php", 'expected' => 'other_layout'),
13 => array('url' => SITEURL."plugin/", 'script' => "/myplugin.php", 'expected' => 'other_layout'),
14 => array('url' => SITEURL."forum/index.php", 'script' => "/index.php", 'expected' => 'other_layout'),
15 => array('url' => SITEURL."my-chapter/my-title", 'script' => "/page.php", 'expected' => 'other_layout'),
16 => array('url' => SITEURL."my-sef-url", 'script' => '/index.php', 'expected' => 'jumbotron_home'),
17 => array('url' => SITEURL."user/settings?id=1", 'script' => '/usersettings.php', 'expected' => 'other_layout'),
18 => array('url' => SITEURL."user/Tijn", 'script' => '/user.php', 'expected' => 'jumbotron_sidebar_right'),
19 => array('url' => SITEURL."user.php?id.1", 'script' => '/user.php', 'expected' => 'jumbotron_sidebar_right'),
20 => array('url' => SITEURL."pluginpage/", 'script' => '/myplugin/index.php', 'expected' => 'script_match'),
21 => array('url' => SITEURL."news/?page=", 'script' => '/news.php', 'expected' => 'jumbotron_home'),
22 => array('url' => SITEURL."news/my-news-title", 'script' => '/news.php', 'expected' => 'jumbotron_sidebar_right'),
23 => array('url' => SITEURL."news/?bla", 'script' => '/news.php', 'expected' => 'other_layout'),
0 => array('url' => SITEURL . "index.php", 'expected' => 'jumbotron_home'),
1 => array('url' => SITEURL . "index.php?", 'expected' => 'jumbotron_home'),
2 => array('url' => SITEURL . "index.php?fbclid=asdlkjasdlakjsdasd", 'expected' => 'jumbotron_home'),
3 => array('url' => SITEURL . "index.php?utm_source=asdd&utm_medium=asdsd", 'expected' => 'jumbotron_home'),
4 => array('url' => SITEURL . "news", 'expected' => 'jumbotron_sidebar_right'),
5 => array('url' => SITEURL . "forum", 'script' => "/forum/index.php", 'expected' => 'jumbotron_full'),
6 => array('url' => SITEURL . "other/page", 'script' => '/page.php', 'expected' => 'other_layout'),
7 => array('url' => SITEURL . "news.php?5.3", 'script' => '/news.php', 'expected' => 'jumbotron_sidebar_right'),
8 => array('url' => SITEURL . "usersettings.php", 'script' => '/usersettings.php', 'expected' => 'jumbotron_sidebar_right'),
9 => array('url' => SITEURL . "user.php", 'script' => '/user.php', 'expected' => 'jumbotron_full'),
10 => array('url' => SITEURL . "page.php", 'script' => '/page.php', 'expected' => 'other_layout'),
11 => array('url' => SITEURL . "page.php?3", 'script' => '/page.php', 'expected' => 'jumbotron_home'),
12 => array('url' => SITEURL . "somepage/", 'script' => "/script.php", 'expected' => 'other_layout'),
13 => array('url' => SITEURL . "plugin/", 'script' => "/myplugin.php", 'expected' => 'other_layout'),
14 => array('url' => SITEURL . "forum/index.php", 'script' => "/index.php", 'expected' => 'other_layout'),
15 => array('url' => SITEURL . "my-chapter/my-title", 'script' => "/page.php", 'expected' => 'other_layout'),
16 => array('url' => SITEURL . "my-sef-url", 'script' => '/index.php', 'expected' => 'jumbotron_home'),
17 => array('url' => SITEURL . "user/settings?id=1", 'script' => '/usersettings.php', 'expected' => 'other_layout'),
18 => array('url' => SITEURL . "user/Tijn", 'script' => '/user.php', 'expected' => 'jumbotron_sidebar_right'),
19 => array('url' => SITEURL . "user.php?id.1", 'script' => '/user.php', 'expected' => 'jumbotron_sidebar_right'),
20 => array('url' => SITEURL . "pluginpage/", 'script' => '/myplugin/index.php', 'expected' => 'script_match'),
21 => array('url' => SITEURL . "news/?page=", 'script' => '/news.php', 'expected' => 'jumbotron_home'),
22 => array('url' => SITEURL . "news/my-news-title", 'script' => '/news.php', 'expected' => 'jumbotron_sidebar_right'),
23 => array('url' => SITEURL . "news/?bla", 'script' => '/news.php', 'expected' => 'other_layout'),
// Using e_ROUTE;
24 => array('url' => 'whatever.php', 'script'=>'whatever.php', 'route'=> 'news/view/index', 'expected'=> 'other_layout'),
25 => array('url' => 'whatever.php', 'script'=>'whatever.php', 'route'=> 'forum/index', 'expected'=> 'jumbotron_full'),
26 => array('url' => 'whatever.php', 'script'=>'whatever.php', 'route'=> 'myplugin/index', 'expected'=> 'jumbotron_full'),
24 => array('url' => 'whatever.php', 'script' => 'whatever.php', 'route' => 'news/view/index', 'expected' => 'other_layout'),
25 => array('url' => 'whatever.php', 'script' => 'whatever.php', 'route' => 'forum/index', 'expected' => 'jumbotron_full'),
26 => array('url' => 'whatever.php', 'script' => 'whatever.php', 'route' => 'myplugin/index', 'expected' => 'jumbotron_full'),
);
$themeObj = $this->tm;
foreach($tests as $item=>$var)
foreach($tests as $item => $var)
{
$var['script'] = isset($var['script']) ? $var['script'] : null;
$result = $themeObj::getThemeLayout($pref, $defaultLayout, $var);
$diz = isset($var['route']) ? $var['route'] : $var['url'];
$this->assertEquals($var['expected'],$result, "Wrong theme layout returned for item [".$item."] ".$diz);
$this->assertEquals($var['expected'], $result, "Wrong theme layout returned for item [" . $item . "] " . $diz);
// echo $var['url']."\t\t\t".$result."\n\n";
}
@@ -541,7 +541,8 @@
// print_r($_SERVER);
}
/*
/*
public function testClearCache()
{
@@ -556,12 +557,110 @@
{
}
*/
public function testParse_theme_xml()
{
$tests = array(
'bootstrap3' => array(
'library' => array (
0 =>
array (
'name' => 'bootstrap',
'version' => '3',
'scope' => 'front,admin,wysiwyg',
),
1 =>
array (
'name' => 'fontawesome',
'version' => '5',
'scope' => 'front,admin,wysiwyg',
),
2 =>
array (
'name' => 'bootstrap.editable',
'version' => '',
'scope' => 'admin',
),
)
),
'bootstrap5' => array(
'library' => array (
0 =>
array (
'name' => 'bootstrap',
'version' => '5',
'scope' => 'front',
),
1 =>
array (
'name' => 'fontawesome',
'version' => '5',
'scope' => 'front',
),
),
),
'voux' => array( // theme using defines for FONTAWESOME and BOOTSTRAP
'library' => array (
0 =>
array (
'name' => 'bootstrap',
'version' => '3',
'scope' => 'front,wysiwyg',
),
1 =>
array (
'name' => 'fontawesome',
'version' => '4',
'scope' => 'front,wysiwyg',
),
)
),
);
foreach($tests as $theme => $var)
{
$result = e_theme::parse_theme_xml($theme);
foreach($var as $att => $value)
{
if(empty($value))
{
var_export($result[$att]);
continue;
}
$this->assertSame($result[$att], $value);
}
}
*/
}
public function testGetLegacyBSFA()
{
$result = e_theme::getLegacyBSFA('voux');
$expected = array (
0 =>
array (
'name' => 'bootstrap',
'version' => '3',
'scope' => 'front,wysiwyg',
),
1 =>
array (
'name' => 'fontawesome',
'version' => '4',
'scope' => 'front,wysiwyg',
),
);
$this->assertSame($expected, $result);
}
@@ -573,7 +672,7 @@
// }
/*
/*
public function testGetThemesMigrations()
{
$thm = e107::getSingleton('themeHandler');
@@ -592,9 +691,9 @@
}
*/
*/
/*
/*
public function testThemeInfoMigration()
{
$thm = e107::getSingleton('themeHandler');
@@ -614,6 +713,6 @@
$this->assertSame($old, $new);
}
*/
*/
}
}

View File

@@ -1,15 +1,16 @@
<?php
class wysiwygTest extends \Codeception\Test\Unit
{
class wysiwygTest extends \Codeception\Test\Unit
{
/** @var wysiwyg */
protected $tm;
protected function _before()
{
require_once(e_PLUGIN."tinymce4/wysiwyg_class.php");
require_once(e_PLUGIN . "tinymce4/wysiwyg_class.php");
try
{
$this->tm = $this->make('wysiwyg');
@@ -21,7 +22,8 @@
}
}
/*
/*
public function testGetExternalPlugins()
{
@@ -39,19 +41,42 @@
public function testGetEditorCSS()
{
$expected = array (
$tests = array(
'bootstrap3' => array(
0 => '/e107_web/lib/bootstrap/3/css/bootstrap.min.css',
1 => '/e107_web/lib/font-awesome/5/css/all.min.css',
2 => '/e107_web/lib/font-awesome/5/css/v4-shims.min.css',
3 => '/e107_web/lib/animate.css/animate.min.css',
4 => '/e107_plugins/tinymce4/editor.css',
),
'voux' => array (
0 => '/e107_web/lib/bootstrap/3/css/bootstrap.min.css',
1 => '/e107_web/lib/font-awesome/4.7.0/css/font-awesome.min.css',
2 => '/e107_web/lib/animate.css/animate.min.css',
3 => '/e107_plugins/tinymce4/editor.css',
)
);
$result = $this->tm->getEditorCSS();
foreach($tests as $themedir => $expected)
{
$result = $this->tm->getEditorCSS($themedir);
if(empty($expected))
{
var_export($result);
continue;
}
$this->assertSame($expected, $result);
}
}
/*
/*
public function testGetTemplates()
{
@@ -76,8 +101,7 @@
{
}
*/
*/
}
}