1
0
mirror of https://github.com/e107inc/e107.git synced 2025-10-14 14:34:51 +02:00
Files
php-e107/tests/unit/e_pluginTest.php
2018-12-17 10:39:19 -08:00

218 lines
3.0 KiB
PHP

<?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 testBuildAddonPrefList()
{
$newUrls = array('gallery'=>0, 'news'=>'news', 'rss_menu'=>0);
e107::getConfig()->setData('e_url_list', $newUrls)->save(false,false,false);
$urlsBefore = e107::pref('core', 'e_url_list');
// print_r($urlsBefore);
$this->ep->buildAddonPrefLists();
$urlsAfter = e107::pref('core', 'e_url_list');
// print_r($urlsAfter);
$this->assertEquals($urlsBefore['gallery'],$urlsAfter['gallery']);
}
/*
public function testGetInstallRequired()
{
}
public function testGetUpgradableList()
{
}
public function testIsLegacy()
{
}
*/
public function testSetInstalled()
{
$this->ep->setInstalled('some-plugin', '1.3');
$arr = $this->ep->getInstalled();
$this->assertArrayHasKey('some-plugin', $arr);
// print_r($arr);
}
/*
public function testIsInstalled()
{
$this->ep->setInstalled('some-plugin', '1.3');
$val = $this->ep->load('some-plugin')->isInstalled();
// var_dump($val);
}*/
/*
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()
{
}*/
}