From 0a1d76884073fab5c2665cf62b94d33c44b789bb Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 23 Jul 2018 14:02:30 -0700 Subject: [PATCH] Made it easier to debug a single plugin. Added extra checks in the linksword plugin test. Disabled empty db_verify tests. --- tests/unit/db_verifyTest.php | 4 ++-- tests/unit/e_arrayTest.php | 16 ++++++++++++++++ tests/unit/pluginsTest.php | 22 +++++++++++++++++----- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/tests/unit/db_verifyTest.php b/tests/unit/db_verifyTest.php index 38262e0e1..744e56032 100644 --- a/tests/unit/db_verifyTest.php +++ b/tests/unit/db_verifyTest.php @@ -11,7 +11,7 @@ class db_verifyTest extends \Codeception\Test\Unit { - +/* public function testGetFields() { @@ -115,5 +115,5 @@ public function testGetSqlLanguages() { - } + }*/ } diff --git a/tests/unit/e_arrayTest.php b/tests/unit/e_arrayTest.php index dce5fd884..b4c0d93c0 100644 --- a/tests/unit/e_arrayTest.php +++ b/tests/unit/e_arrayTest.php @@ -65,6 +65,22 @@ $actual = $this->arrObj->unserialize($string_4); $this->assertArrayHasKey('json', $actual); + // case linkwords prefs. + $string_5 = "array ( + 'OLDDEFAULT' => '', + 'TITLE' => '', + 'SUMMARY' => 1, + 'BODY' => 1, + 'DESCRIPTION'=> 1, + 'USER_TITLE' => '', + 'USER_BODY' => 1, + 'LINKTEXT' => '', + 'RAWTEXT' => '' + )"; + + $actual = $this->arrObj->unserialize($string_5); + $this->assertArrayHasKey('TITLE', $actual); + } /* diff --git a/tests/unit/pluginsTest.php b/tests/unit/pluginsTest.php index 817a63ef8..f1c7fd0c6 100644 --- a/tests/unit/pluginsTest.php +++ b/tests/unit/pluginsTest.php @@ -12,7 +12,7 @@ class pluginsTest extends \Codeception\Test\Unit { - // protected $_plg; + protected $_debugPlugin = false; // 'linkwords'; // add plugin-dir for full report. protected function _before() { @@ -26,8 +26,9 @@ }*/ } - private function makePluginReport($pluginDir, $debug=false) + private function makePluginReport($pluginDir) { + $debug = $this->_debugPlugin; $debug_text = "\n\n---- Log \n\n"; $log = e107::getPlugin()->getLog(); @@ -100,9 +101,10 @@ $debug_text .= "-------------------------------------------------------------------\n"; - if($debug === true) + if(!empty($debug) && $pluginDir === $debug) { codecept_debug($debug_text); + echo $debug_text; } return array( @@ -185,7 +187,17 @@ public function testLinkwords() { $this->pluginInstall('linkwords'); + + $pref1 = e107::pref('core', 'lw_custom_class'); + $this->assertNotEmpty($pref1); + + $pref2 = e107::pref('core', 'lw_context_visibility'); + $this->assertNotEmpty($pref2['SUMMARY']); + $this->pluginUninstall('linkwords'); + + $pref2 = e107::pref('core', 'lw_context_visibility'); + $this->assertEmpty($pref2); } public function testPm() @@ -223,7 +235,7 @@ e107::getPlugin()->install($pluginDir); - $install = $this->makePluginReport($pluginDir, false); // set to true to see more info + $install = $this->makePluginReport($pluginDir); //todo additional checks @@ -242,7 +254,7 @@ e107::getPlugin()->uninstall($pluginDir, $opts); - $uninstall = $this->makePluginReport($pluginDir, false); // set to true to see more info + $uninstall = $this->makePluginReport($pluginDir); //todo additional checks