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

Frontend scripts tests. (may break some things)

This commit is contained in:
Cameron
2021-01-19 18:52:56 -08:00
parent ce1273f8a4
commit b19f9ffbc3
41 changed files with 312 additions and 395 deletions

View File

@@ -848,7 +848,7 @@ class e107Test extends \Codeception\Test\Unit
{
// Make sure nothing else loaded the language files.
$this->assertFalse(defined('BANNERLAN_19'), 'BANNERLAN_19 is already defined!');
// $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');
@@ -970,7 +970,7 @@ class e107Test extends \Codeception\Test\Unit
public function testCanonical()
{
$e107 = $this->e107;
$e107::canonical('_RESET_');
$e107::canonical('news');
$result = $e107::canonical();

View File

@@ -168,6 +168,9 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
$this->fail($e->getMessage());
}
$sc->__construct();
$this->processShortcodeMethods($sc);
}
@@ -185,6 +188,8 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
$this->fail($e->getMessage());
}
$sc->__construct();
$this->processShortcodeMethods($sc);
}
@@ -230,6 +235,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
'user_join' => 1518441749
);
$sc->__construct();
$sc->setVars($values);
$this->processShortcodeMethods($sc);
@@ -251,6 +257,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
$this->fail($e->getMessage());
}
$sc->__construct();
$this->processShortcodeMethods($sc);
}
@@ -269,6 +276,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
$this->fail($e->getMessage());
}
$sc->__construct();
$this->processShortcodeMethods($sc);
}
@@ -287,6 +295,8 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
$this->fail($e->getMessage());
}
$sc->__construct();
$this->processShortcodeMethods($sc);
}
@@ -321,6 +331,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
'link_owner' => 'news'
);
$sc->__construct();
$sc->setVars($vars);
$this->processShortcodeMethods($sc);
@@ -389,6 +400,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
'user_name' => 'admin'
);
$sc->__construct();
$sc->setVars($vars);
$this->processShortcodeMethods($sc);
@@ -502,7 +514,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
'menu_button_text' => ''
);
$sc->__construct();
$sc->setVars($vars);
$exclude = array('sc_cpagemessage'); // system messages
@@ -569,7 +581,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
)
;
$sc->__construct();
$sc->setVars($vars);
// $exclude = array('sc_cpagemessage'); // system messages
@@ -613,6 +625,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
$this->fail($e->getMessage());
}
$sc->__construct();
$this->processShortcodeMethods($sc);
}
@@ -662,8 +675,10 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
);
$sc->__construct();
$sc->setVars($vars);
$exclude = array('sc_user_email'); // uses random obfiscation.
$this->processShortcodeMethods($sc, null, $exclude);
@@ -742,6 +757,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
$this->fail($e->getMessage());
}
$vars = array(
'cb_id' => '11',
'cb_nick' => '1.admin',
@@ -751,6 +767,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
'cb_ip' => '0000:0000:0000:0000:0000:ffff:7f00:0001'
);
$sc->__construct();
$sc->setVars($vars);
$this->processShortcodeMethods($sc);
@@ -804,6 +821,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
);
$sc->__construct();
$sc->setVars($values);
$this->processShortcodeMethods($sc);
@@ -903,6 +921,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
);
$sc->__construct();
$sc->setVars($vars);
$this->processShortcodeMethods($sc);
@@ -1177,7 +1196,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
);
$sc->__construct();
$sc->setVars($vars);
$exclude = array('sc_gallery_slides'); // uses a counter.
$this->processShortcodeMethods($sc, null, $exclude);
@@ -1259,7 +1278,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
);
$sc->__construct();
$sc->setVars($vars);
// $exclude = array('sc_gallery_slides'); // uses a counter.
$this->processShortcodeMethods($sc);
@@ -1281,7 +1300,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
$this->fail($e->getMessage());
}
$sc->__construct();
$this->processShortcodeMethods($sc);
@@ -1415,12 +1434,15 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
{
/** @var list_shortcodes $sc */
$sc = $this->make('list_shortcodes');
}
catch (Exception $e)
{
$this->fail($e->getMessage());
}
$sc->__construct();
$sc->rc = new listclass;
$vars = array (
@@ -1464,6 +1486,8 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
private function processShortcodeMethods($sc, $parms=array(), $exclude=array())
{
$sc->wrapper('non-existent/wrapper');
$list = get_class_methods($sc);
foreach($list as $meth)

View File

@@ -35,7 +35,58 @@
}
private function loadScripts($folder, $exclude= array())
public function testFrontend()
{
e107::getConfig()->setPref('plug_installed/gsitemap', '1.0');
$include = array (
0 => 'banner.php',
// 1 => 'class2.php',
// 2 => 'comment.php',
3 => 'contact.php',
// 5 => 'cron.php',
// 6 => 'download.php',
// 7 => 'e107_config.php',
// 12 => 'email.php',
13 => 'error.php',
15 => 'fpw.php',
16 => 'gsitemap.php',
// 17 => 'index.php', // redirects
// 18 => 'install.php', // not compatible with core.
20 => 'login.php',
21 => 'membersonly.php',
// 22 => 'metaweblog.php',
23 => 'news.php',
24 => 'online.php',
25 => 'page.php',
// 26 => 'print.php',
// 27 => 'rate.php', // has a redirect.
// 28 => 'request.php', // redirects
29 => 'search.php',
// 30 => 'signup.php', too many 'exit';
31 => 'sitedown.php',
32 => 'submitnews.php',
// 34 => 'thumb.php', // separate test.
35 => 'top.php',
36 => 'unsubscribe.php',
// 37 => 'upload.php', // FIXME LAN conflict.
38 => 'user.php',
// 39 => 'userposts.php', // FIXME needs a rework
40 => 'usersettings.php',
);
$this->loadScripts(e_BASE, array(), $include);
}
private function loadScripts($folder, $exclude= array(), $include=array())
{
// $globalList = e107::getPref('lan_global_list');
@@ -67,12 +118,12 @@
{
$ext = pathinfo($folder.$file, PATHINFO_EXTENSION);
if($ext !== 'php' || in_array($file, $exclude))
if($ext !== 'php' || in_array($file, $exclude) || (!empty($include) && !in_array($file,$include)))
{
continue;
}
// echo " --- ".$file." --- \n";
echo " --- ".$file." --- \n";
ob_start();
// test for PHP Notice/Warning etc.
$error = false;