mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 20:51:53 +02:00
Committing the scripts and language tests.
This commit is contained in:
parent
04bbad449a
commit
ac737d3762
122
e107_tests/tests/unit/languageTest.php
Normal file
122
e107_tests/tests/unit/languageTest.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
|
||||
class languageTest extends \Codeception\Test\Unit
|
||||
{
|
||||
|
||||
/** @var language */
|
||||
protected $lan;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
$this->lan = $this->make('language');
|
||||
}
|
||||
|
||||
catch(Exception $e)
|
||||
{
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testLanguageHelpFiles()
|
||||
{
|
||||
$list = scandir(e_LANGUAGEDIR."English/admin/help");
|
||||
$ns = e107::getRender();
|
||||
$pref = e107::getPref();
|
||||
e107::getMessage()->addInfo("Dummy Info");
|
||||
|
||||
|
||||
foreach($list as $file)
|
||||
{
|
||||
if(strpos($file, ".php") === false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
ob_start();
|
||||
$path = e_LANGUAGEDIR.'English/admin/help/'.$file;
|
||||
require_once($path);
|
||||
$result = ob_get_clean();
|
||||
|
||||
$this->assertNotEmpty($result, $path. " was empty." );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testDetect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetCookieDomain()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testToNative()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSet()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSubdomainUrl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testIsLangDomain()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testTranslate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testBcDefs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testInstalled()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetLanSelectArray()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testIsValid()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSetDefs()
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
83
e107_tests/tests/unit/scriptsTest.php
Normal file
83
e107_tests/tests/unit/scriptsTest.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
|
||||
class scriptsTest extends \Codeception\Test\Unit
|
||||
{
|
||||
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
define("SEP", " <span class='fa fa-angle-double-right e-breadcrumb'></span> ");
|
||||
}
|
||||
|
||||
|
||||
public function testAdminScripts()
|
||||
{
|
||||
// $globalList = e107::getPref('lan_global_list');
|
||||
|
||||
|
||||
$list = scandir(e_ADMIN);
|
||||
|
||||
$config = e107::getConfig();
|
||||
|
||||
$preInstall = array('banner', 'page');
|
||||
$exclude = array('index.php');
|
||||
|
||||
foreach($preInstall as $plug)
|
||||
{
|
||||
e107::getConfig()->setPref('plug_installed/'.$plug, '1.0');
|
||||
}
|
||||
|
||||
global $pref, $ns, $tp, $frm;
|
||||
$pref = e107::getPref();
|
||||
$ns = e107::getRender();
|
||||
$tp = e107::getParser();
|
||||
$frm = e107::getForm();
|
||||
|
||||
|
||||
|
||||
global $_E107;
|
||||
$_E107['cli'] = true;
|
||||
$_E107['no_theme'] = true; //FIXME unable to change to admin theme in testing environment.
|
||||
|
||||
foreach($list as $file)
|
||||
{
|
||||
$ext = pathinfo(e_ADMIN.$file, PATHINFO_EXTENSION);
|
||||
|
||||
if($ext !== 'php' || in_array($file, $exclude))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// echo " --- ".$file." --- \n";
|
||||
ob_start();
|
||||
// test for PHP Notice/Warning etc.
|
||||
$error = false;
|
||||
|
||||
if(require_once(e_ADMIN.$file))
|
||||
{
|
||||
$this->assertTrue(true, "loading ".$file);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = true;
|
||||
}
|
||||
ob_end_clean();
|
||||
|
||||
if($error)
|
||||
{
|
||||
$this->fail("Couldn't load ".$file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user