mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
plugin tests. Currently failing on remotePluginTest. (reason unknown)
This commit is contained in:
@@ -12,14 +12,14 @@
|
|||||||
class e107pluginTest extends \Codeception\Test\Unit
|
class e107pluginTest extends \Codeception\Test\Unit
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** @var e107plugin */
|
||||||
protected $ep;
|
protected $ep;
|
||||||
|
|
||||||
protected function _before()
|
protected function _before()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->tp = $this->make('e107_plugin');
|
$this->ep = $this->make('e107plugin');
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
@@ -28,6 +28,18 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testGetPluginRecord()
|
||||||
|
{
|
||||||
|
$result = $this->ep::getPluginRecord('banner');
|
||||||
|
|
||||||
|
// print_r($result);
|
||||||
|
|
||||||
|
$this->assertEquals("LAN_PLUGIN_BANNER_NAME", $result['plugin_name']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
public function testDisplayArray()
|
public function testDisplayArray()
|
||||||
|
176
tests/unit/e_pluginTest.php
Normal file
176
tests/unit/e_pluginTest.php
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
<?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 e_pluginTest extends \Codeception\Test\Unit
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @var e_plugin */
|
||||||
|
private $ep;
|
||||||
|
|
||||||
|
protected function _before()
|
||||||
|
{
|
||||||
|
// require_once(e_HANDLER."e_marketplace.php");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$this->ep = $this->make('e_plugin');
|
||||||
|
$this->ep->__construct();
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
$this->assertTrue(false, "Couldn't load e_plugin object");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function testGetInstallRequired()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetUpgradableList()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testIsLegacy()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testIsInstalled()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetDetected()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetCompat()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetKeywords()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetId()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetAdminUrl()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetAddons()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetCategoryList()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetAddonErrors()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetIcon()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetInstalled()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetVersion()
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public function testGetFields()
|
||||||
|
{
|
||||||
|
$result = $this->ep->load('forum')->getFields(true);
|
||||||
|
|
||||||
|
// print_r($result);
|
||||||
|
|
||||||
|
$this->assertEquals('LAN_PLUGIN_FORUM_NAME', $result['plugin_name']);
|
||||||
|
$this->assertNotEmpty($result['plugin_id'], "plugin_id was empty" );
|
||||||
|
$this->assertNotEmpty($result['plugin_path'], "plugin_path was empty" );
|
||||||
|
$this->assertEmpty($result['plugin_installflag'], "plugin_installflag was true when it should be false");
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
public function testGetAdminCaption()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetDescription()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetAuthor()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetName()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testBuildAddonPrefLists()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testClearCache()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetMeta()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLoad()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetCategory()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetInstalledWysiwygEditors()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetDate()
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
}
|
@@ -12,7 +12,7 @@
|
|||||||
class pluginsTest extends \Codeception\Test\Unit
|
class pluginsTest extends \Codeception\Test\Unit
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $_debugPlugin = false; // 'linkwords'; // add plugin-dir for full report.
|
protected $_debugPlugin = ''; // 'linkwords'; // add plugin-dir for full report.
|
||||||
|
|
||||||
protected function _before()
|
protected function _before()
|
||||||
{
|
{
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
$result2 = $tp->parseTemplate("{BANNER=e107promo}",true);
|
$result2 = $tp->parseTemplate("{BANNER=e107promo}",true);
|
||||||
|
|
||||||
// The expected value below was the actual observed output when the assertion was written:
|
// The expected value below was the actual observed output when the assertion was written:
|
||||||
$this->assertEquals(' ', $result2);
|
$this->assertEquals(' ', $result2, "Banner shortcode is not returning an empty value, despite banner being uninstalled");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testChatbox_Menu()
|
public function testChatbox_Menu()
|
||||||
@@ -230,6 +230,36 @@
|
|||||||
$this->pluginUninstall('tagcloud');
|
$this->pluginUninstall('tagcloud');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testRemotePlugin()
|
||||||
|
{
|
||||||
|
require_once(e_HANDLER."e_marketplace.php");
|
||||||
|
$mp = new e_marketplace;
|
||||||
|
|
||||||
|
$id = 912; // No-follow plugin on e107.org
|
||||||
|
$status = $mp->download($id, '', 'plugin');
|
||||||
|
|
||||||
|
// $messages = e107::getMessage()->render('default',false,true,true);
|
||||||
|
|
||||||
|
// print_r($messages);
|
||||||
|
// var_dump($status);
|
||||||
|
|
||||||
|
// $this->assertTrue($status, "Couldn't download/move remote plugin");
|
||||||
|
|
||||||
|
$this->pluginInstall('nofollow');
|
||||||
|
|
||||||
|
$opts = array(
|
||||||
|
'delete_tables' => 1,
|
||||||
|
'delete_files' => 1
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->pluginUninstall('nofollow',$opts);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function pluginInstall($pluginDir)
|
private function pluginInstall($pluginDir)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -245,12 +275,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function pluginUninstall($pluginDir)
|
private function pluginUninstall($pluginDir, $opts=array())
|
||||||
{
|
{
|
||||||
$opts = array(
|
if(empty($opts))
|
||||||
'delete_tables' => 1,
|
{
|
||||||
'delete_files' => 0
|
$opts = array(
|
||||||
);
|
'delete_tables' => 1,
|
||||||
|
'delete_files' => 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
e107::getPlugin()->uninstall($pluginDir, $opts);
|
e107::getPlugin()->uninstall($pluginDir, $opts);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user