diff --git a/tests/unit/e107pluginTest.php b/tests/unit/e107pluginTest.php index 856c9e7f1..769f3c5b3 100644 --- a/tests/unit/e107pluginTest.php +++ b/tests/unit/e107pluginTest.php @@ -12,14 +12,14 @@ class e107pluginTest extends \Codeception\Test\Unit { - + /** @var e107plugin */ protected $ep; protected function _before() { try { - $this->tp = $this->make('e107_plugin'); + $this->ep = $this->make('e107plugin'); } 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() diff --git a/tests/unit/e_pluginTest.php b/tests/unit/e_pluginTest.php new file mode 100644 index 000000000..ee5018963 --- /dev/null +++ b/tests/unit/e_pluginTest.php @@ -0,0 +1,176 @@ +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() + { + + }*/ + } diff --git a/tests/unit/pluginsTest.php b/tests/unit/pluginsTest.php index f1c7fd0c6..f9de286b8 100644 --- a/tests/unit/pluginsTest.php +++ b/tests/unit/pluginsTest.php @@ -12,7 +12,7 @@ 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() { @@ -131,7 +131,7 @@ $result2 = $tp->parseTemplate("{BANNER=e107promo}",true); // 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() @@ -230,6 +230,36 @@ $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) { @@ -245,12 +275,15 @@ } } - private function pluginUninstall($pluginDir) + private function pluginUninstall($pluginDir, $opts=array()) { - $opts = array( - 'delete_tables' => 1, - 'delete_files' => 0 - ); + if(empty($opts)) + { + $opts = array( + 'delete_tables' => 1, + 'delete_files' => 0 + ); + } e107::getPlugin()->uninstall($pluginDir, $opts);