1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Draft test for banner plugin.

This commit is contained in:
Cameron
2018-07-19 20:45:16 -07:00
parent d7ca79a0ef
commit 293327de53
3 changed files with 467 additions and 0 deletions

View File

@@ -57,4 +57,44 @@
$this->assertTrue($res);
}
public function testVerifyE107_INIT()
{
$res = true;
if(!defined('e107_INIT'))
{
$res = false;
}
$this->assertTrue($res);
}
public function testVerifyUSERCLASS_LIST()
{
$res = true;
if(!defined('USERCLASS_LIST'))
{
$res = false;
}
$this->assertTrue($res);
}
public function testVerifye_ROOT()
{
$res = true;
if(!defined('e_ROOT'))
{
$res = false;
}
$this->assertTrue($res);
}
}

View File

@@ -0,0 +1,302 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2018 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
class e107pluginTest extends \Codeception\Test\Unit
{
protected $ep;
protected function _before()
{
try
{
$this->tp = $this->make('e107_plugin');
}
catch (Exception $e)
{
$this->assertTrue(false, "Couldn't e107_plugi object");
}
}
/*
public function testDisplayArray()
{
}
public function testExecute_function()
{
}
public function testManage_plugin_prefs()
{
}
public function testInstall()
{
}
public function testGetall()
{
}
public function testXmlPrefs()
{
}
public function testParse_plugin_php()
{
}
public function testRefresh()
{
}
public function testUninstall()
{
}
public function testRebuildUrlConfig()
{
}
public function testManage_icons()
{
}
public function testParse_plugin()
{
}
public function testManage_comments()
{
}
public function testManage_search()
{
}
public function testInstall_plugin_xml()
{
}
public function testGetAddonsDiz()
{
}
public function testUpdate_plugins_table()
{
}
public function testXmlBBcodes()
{
}
public function testInstall_plugin()
{
}
public function testManage_extended_field_sql()
{
}
public function testUpdateRequired()
{
}
public function testGetCorePlugins()
{
}
public function testManage_prefs()
{
}
public function testGetPerm()
{
}
public function testGetAddonsList()
{
}
public function testXmlExtendedFields()
{
}
public function testGetAddons()
{
}
public function testUe_field_type()
{
}
public function testManage_userclass()
{
}
public function testXmlSiteLinks()
{
}
public function testGetIcon()
{
}
public function testGetId()
{
}
public function testXmlLanguageFileCheck()
{
}
public function testSetUe()
{
}
public function testManage_tables()
{
}
public function testInstall_plugin_php()
{
}
public function testXmlMediaCategories()
{
}
public function testXmlDependencies()
{
}
public function testXmlTables()
{
}
public function testXmlUserClasses()
{
}
public function testCheckAddon()
{
}
public function testManage_notify()
{
}
public function testUe_field_type_name()
{
}
public function testManage_link()
{
}
public function testUe_field_name()
{
}
public function testIsUsedByAnotherPlugin()
{
}
public function testGetOtherPlugins()
{
}
public function testGetLog()
{
}
public function testManage_category()
{
}
public function testGetinfo()
{
}
public function testXmlAdminLinks()
{
}
public function testXmlLanguageFiles()
{
}
public function testManage_extended_field()
{
}
public function testParse_plugin_xml()
{
}*/
}

125
tests/unit/pluginsTest.php Normal file
View File

@@ -0,0 +1,125 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2018 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
class pluginsTest extends \Codeception\Test\Unit
{
// protected $_plg;
protected function _before()
{
/*try
{
$this->_plg = $this->make('e107plugin');
}
catch (Exception $e)
{
$this->assertTrue(false, "Couldn't load e107plugin object");
}*/
}
private function dumpInfo($plugin)
{
$tp = e107::getParser();
echo "Log ------------\n";
$log = e107::getPlugin()->getLog();
foreach($log as $line)
{
echo " - ".$line."\n";
}
echo "-------------------\n\n";
echo "-- Pref: plug_installed (version)\n\n";
$pref = e107::getConfig('core',true,true)->get('plug_installed');
print_r($pref[$plugin]);
echo "\n-- Plugin Prefs: \n\n";
$table = e107::pref($plugin);
print_r($table);
echo "\n-- Plugin Table: ".$plugin."\n\n";
$table = e107::getDb()->retrieve('plugin','*', "plugin_path='".$plugin."' LIMIT 1", true);
print_r($table);
echo "\n-- Menu Table: ".$plugin."\n\n";
$table = e107::getDb()->retrieve('menus','*', "menu_location = 0 AND menu_path='".$plugin."/' LIMIT 10", true);
print_r($table);
echo "\n-- Site Links Table: ".$plugin."\n\n";
$table = e107::getDb()->retrieve('links','*', "link_owner='".$plugin."' ", true);
print_r($table);
$dir = scandir(e_PLUGIN.$plugin);
$corePref = e107::getConfig('core',true,true)->getPref();
echo "\n-- Addons\n\n";
echo "----------------------------------------\n";
echo "Addon file\t\tIn Core pref e_xxxx_list\n\n";
foreach($dir as $file)
{
$name = basename($file,".php");
if(substr($file,0,2) === 'e_')
{
$key = $name."_list";
$status = !empty($corePref[$key][$plugin]) ? 'YES' : 'NO';
echo $file."\t\t".$status."\n";
}
}
echo "----------------------------------------\n\n\n";
}
function testBanner()
{
e107::getPlugin()->install('banner');
$tp = e107::getParser();
$result = $tp->parseTemplate("{BANNER=e107promo}",true);
$this->assertContains("<img class='e-banner img-responsive img-fluid'",$result);
$opts = array(
'delete_tables' => 1,
'delete_files' => 0
);
e107::getPlugin()->uninstall('banner', $opts);
$result = $tp->parseTemplate("{BANNER=e107promo}",true); // should return null since plugin is uninstalled.
// $this->dumpInfo('banner'); // see more values to test
}
}