1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +02:00

Possible fixes.

This commit is contained in:
Cameron
2019-12-04 10:10:32 -08:00
committed by Deltik
parent 369142af55
commit 3b28884b56
2 changed files with 64 additions and 62 deletions

View File

@@ -1044,64 +1044,63 @@ class e_formTest extends \Codeception\Test\Unit
public function testRenderLink()
{
# FIXME: https://github.com/e107inc/e107/issues/4032
// $tests = array(
// 0 => array(
// 'value' => 'Some text',
// 'parms' => array('link'=>'myurl.php', 'target'=>'blank'),
// 'expected' => "<a class='e-tip' rel='external' href='myurl.php' title='Quick View' >Some text</a>"
// ),
// 1 => array(
// 'value' => 'Some text',
// 'parms' => array('link'=>'myurl.php?id=[id]', 'target'=>'modal'),
// 'expected' => "<a class='e-tip' href='myurl.php?id=3' data-toggle='modal' data-cache='false' data-target='#uiModal' title='Quick View' >Some text</a>"
// ),
// 2 => array(
// 'value' => 'Some text',
// 'parms' => array('link'=>'url_001', 'target'=>'blank'),
// 'expected' => "<a class='e-tip' rel='external' href='https://e107.org' title='Quick View' >Some text</a>"
// ),
// 3 => array(
// 'value' => 'Some text',
// 'parms' => array('link'=>'myurl.php?country=[country_001]', 'target'=>'dialog'),
// 'expected' => "<a class='e-tip e-modal' href='myurl.php?country=au' title='Quick View' >Some text</a>"
// ),
// 4 => array(
// 'value' => 'Some text',
// 'parms' => array('url'=>'rss', 'title'=>'Click Here'),
// 'expected' => "<a class='e-tip' href='".e_HTTP."feed/rss-sefurl/rss/5' title='Click Here' >Some text</a>"
// )
$tests = array(
0 => array(
'value' => 'Some text',
'parms' => array('link'=>'myurl.php', 'target'=>'blank'),
'expected' => "<a class='e-tip' rel='external' href='myurl.php' title='Quick View' >Some text</a>"
),
1 => array(
'value' => 'Some text',
'parms' => array('link'=>'myurl.php?id=[id]', 'target'=>'modal'),
'expected' => "<a class='e-tip' href='myurl.php?id=3' data-toggle='modal' data-cache='false' data-target='#uiModal' title='Quick View' >Some text</a>"
),
2 => array(
'value' => 'Some text',
'parms' => array('link'=>'url_001', 'target'=>'blank'),
'expected' => "<a class='e-tip' rel='external' href='https://e107.org' title='Quick View' >Some text</a>"
),
3 => array(
'value' => 'Some text',
'parms' => array('link'=>'myurl.php?country=[country_001]', 'target'=>'dialog'),
'expected' => "<a class='e-tip e-modal' href='myurl.php?country=au' title='Quick View' >Some text</a>"
),
/* 4 => array(
'value' => 'Some text',
'parms' => array('url'=>'rss', 'title'=>'Click Here'),
'expected' => "<a class='e-tip' href='".e_HTTP."feed/rss-sefurl/rss/5' title='Click Here' >Some text</a>"
)*/
// );
);
// try
// {
// /** @var e_admin_model $model */
// $model = $this->make('e_admin_model');
// }
// catch (Exception $e)
// {
// $this->assertTrue(false, "Couldn't load e_admin_model object");
// }
try
{
/** @var e_admin_model $model */
$model = $this->make('e_admin_model');
}
catch (Exception $e)
{
$this->assertTrue(false, "Couldn't load e_admin_model object");
}
// $model->setData($this->_values);
$model->setData($this->_values);
// $model->setData('rss_url', 'rss-sefurl');
// $model->setData('rss_topicid', '5');
$model->setData('rss_url', 'rss-sefurl');
$model->setData('rss_topicid', '5');
// e107::setRegistry('core/adminUI/currentListModel', $model);
// e107::setRegistry('core/adminUI/currentPlugin', 'rss_menu');
e107::setRegistry('core/adminUI/currentListModel', $model);
e107::setRegistry('core/adminUI/currentPlugin', 'rss_menu');
// foreach($tests as $t)
// {
// $result = $this->_frm->renderLink($t['value'], $t['parms'], 3);
// $this->assertEquals($t['expected'],$result);
// }
foreach($tests as $t)
{
$result = $this->_frm->renderLink($t['value'], $t['parms'], 3);
$this->assertEquals($t['expected'],$result);
}

View File

@@ -84,10 +84,10 @@
'bootstrap3' => array (
'templates' => array( // template key and string length
'jumbotron_home' => 2940,
'modern_business_home' => 3746,
'jumbotron_full' => 1949,
'jumbotron_sidebar_right' => 2765
'jumbotron_home' => 3132,
'modern_business_home' => 3842,
'jumbotron_full' => 2239,
'jumbotron_sidebar_right' => 2973
),
'menus' => array (
'jumbotron_home' => array ('1','2','3','4','5','6','7','8','9','10','11','12','13','14','100','101','102','103','104','105','106','107',),
@@ -100,8 +100,8 @@
'testkubrick' => array (
'templates' => array(
'legacyCustom' => 283,
'legacyDefault' => 328
'legacyCustom' => 267,
'legacyDefault' => 308
),
'menus' => array(
'legacyCustom' => array(),
@@ -111,9 +111,9 @@
'testcore' => array (
'templates' => array (
'HOME' => 1635,
'FULL' => 1378,
'legacyDefault'=> 1807
'HOME' => 1494,
'FULL' => 1269,
'legacyDefault'=> 1654
),
'menus' => array(
'HOME' => array('2', '3', '4'),
@@ -124,10 +124,10 @@
'basic-light' => array(
'templates' => array(
'default' => 3359,
'default-home' => 3359,
'simple-page' => 1604,
'wide-page' => 1272
'default' => 3274,
'default-home' => 3274,
'simple-page' => 1553,
'wide-page' => 1235
),
'menus' => array(
'default' => array('1', '2', '3', '4'),
@@ -142,13 +142,16 @@
foreach($tests as $theme=>$vars)
{
$result = e_menu_layout::getLayouts($theme);
foreach($vars['templates'] as $key=>$length)
{
$content = str_replace(array("\r", "\n"),'',$result['templates'][$key]);
$expectedLength = $length;
$actualLength = strlen($result['templates'][$key]);
$actualLength = strlen($content);
//var_dump($key. " = ".$actualLength);
$this->assertEquals($expectedLength, $actualLength, $key. " is different");
}