From 3b28884b565c0cebf0e2f2ccb8d5fee6ca3ca6ea Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 4 Dec 2019 10:10:32 -0800 Subject: [PATCH] Possible fixes. --- e107_tests/tests/unit/e_formTest.php | 93 ++++++++++----------- e107_tests/tests/unit/e_menu_layoutTest.php | 33 ++++---- 2 files changed, 64 insertions(+), 62 deletions(-) diff --git a/e107_tests/tests/unit/e_formTest.php b/e107_tests/tests/unit/e_formTest.php index 9dbd60dd0..bedff6d47 100644 --- a/e107_tests/tests/unit/e_formTest.php +++ b/e107_tests/tests/unit/e_formTest.php @@ -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' => "Some text" -// ), -// 1 => array( -// 'value' => 'Some text', -// 'parms' => array('link'=>'myurl.php?id=[id]', 'target'=>'modal'), -// 'expected' => "Some text" -// ), -// 2 => array( -// 'value' => 'Some text', -// 'parms' => array('link'=>'url_001', 'target'=>'blank'), -// 'expected' => "Some text" -// ), -// 3 => array( -// 'value' => 'Some text', -// 'parms' => array('link'=>'myurl.php?country=[country_001]', 'target'=>'dialog'), -// 'expected' => "Some text" -// ), -// 4 => array( -// 'value' => 'Some text', -// 'parms' => array('url'=>'rss', 'title'=>'Click Here'), -// 'expected' => "Some text" -// ) + $tests = array( + 0 => array( + 'value' => 'Some text', + 'parms' => array('link'=>'myurl.php', 'target'=>'blank'), + 'expected' => "Some text" + ), + 1 => array( + 'value' => 'Some text', + 'parms' => array('link'=>'myurl.php?id=[id]', 'target'=>'modal'), + 'expected' => "Some text" + ), + 2 => array( + 'value' => 'Some text', + 'parms' => array('link'=>'url_001', 'target'=>'blank'), + 'expected' => "Some text" + ), + 3 => array( + 'value' => 'Some text', + 'parms' => array('link'=>'myurl.php?country=[country_001]', 'target'=>'dialog'), + 'expected' => "Some text" + ), + /* 4 => array( + 'value' => 'Some text', + 'parms' => array('url'=>'rss', 'title'=>'Click Here'), + 'expected' => "Some text" + )*/ -// ); + ); -// 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); + } diff --git a/e107_tests/tests/unit/e_menu_layoutTest.php b/e107_tests/tests/unit/e_menu_layoutTest.php index cfe5a2cf7..e07beabf2 100644 --- a/e107_tests/tests/unit/e_menu_layoutTest.php +++ b/e107_tests/tests/unit/e_menu_layoutTest.php @@ -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"); }