diff --git a/e107_tests/tests/unit/e107Test.php b/e107_tests/tests/unit/e107Test.php index b03bff553..fdcd224a8 100644 --- a/e107_tests/tests/unit/e107Test.php +++ b/e107_tests/tests/unit/e107Test.php @@ -1076,6 +1076,7 @@ class e107Test extends \Codeception\Test\Unit $e107 = $this->e107; $templates = scandir(e_CORE . "templates"); + // Load these constants before other tests fail because of what this test does: $e107::loadAdminIcons(); $exclude = array( @@ -1357,7 +1358,6 @@ class e107Test extends \Codeception\Test\Unit public function testThemeLan() { $result = e107::themeLan(null, 'basic-light'); - var_dump($result); }*/ /* @@ -1887,9 +1887,6 @@ class e107Test extends \Codeception\Test\Unit // $this->e107->prepare_request(); - // var_dump($_SERVER['QUEST_STRING']); - - // $res = null; // $this->assertTrue($res); } @@ -2009,12 +2006,10 @@ class e107Test extends \Codeception\Test\Unit $result = $obj::isInstalled('user'); - // var_dump($result); $this->assertTrue($result); $result = $obj::isInstalled('news'); - // var_dump($result); $this->assertTrue($result); } diff --git a/e107_tests/tests/unit/e107_user_extendedTest.php b/e107_tests/tests/unit/e107_user_extendedTest.php index 8cb15d789..030ad971f 100644 --- a/e107_tests/tests/unit/e107_user_extendedTest.php +++ b/e107_tests/tests/unit/e107_user_extendedTest.php @@ -116,21 +116,9 @@ ); // clear the table. - $sql = e107::getDb(); - /* $fieldCount = (int) $sql->count('user_extended_struct'); - - if($fieldCount > 17) - { - codecept_debug("Truncating user_extended_struct"); - $sql->truncate('user_extended_struct'); - - }*/ - $sql->truncate('user_extended_struct'); - - // Add a field of each type. foreach($this->structTypes as $k=> $v) { @@ -1124,7 +1112,6 @@ { $data = $this->ue->getFields(); $this->assertArrayHasKey('text', $data); - // var_dump($data); // $this->assertCount(15, $data); $data = $this->ue->getFields(16); diff --git a/e107_tests/tests/unit/e_admin_uiTest.php b/e107_tests/tests/unit/e_admin_uiTest.php index 0c2362a7c..3b1befe59 100644 --- a/e107_tests/tests/unit/e_admin_uiTest.php +++ b/e107_tests/tests/unit/e_admin_uiTest.php @@ -25,12 +25,7 @@ { $result = preg_replace('/[^\w\-:.]/', '', $var['text']); // this pattern used in parts of the admin-ui. $this->assertEquals($var['expected'], $result); - //var_dump($result); } - - // echo array_flip(get_defined_constants(true)['pcre'])[preg_last_error()]; - - } diff --git a/e107_tests/tests/unit/e_arrayTest.php b/e107_tests/tests/unit/e_arrayTest.php index 964368edf..d2a03347a 100644 --- a/e107_tests/tests/unit/e_arrayTest.php +++ b/e107_tests/tests/unit/e_arrayTest.php @@ -132,10 +132,6 @@ $data = array ( $input = array('myarray'=>'myvalue'); $result = $this->arrObj->unserialize($input); $this->assertSame($input, $result); - - - // var_dump($actual); - } /* diff --git a/e107_tests/tests/unit/e_db_abstractTest.php b/e107_tests/tests/unit/e_db_abstractTest.php index 3408fc695..35c8dffb7 100644 --- a/e107_tests/tests/unit/e_db_abstractTest.php +++ b/e107_tests/tests/unit/e_db_abstractTest.php @@ -851,11 +851,17 @@ abstract class e_db_abstractTest extends \Codeception\Test\Unit public function testIsEmpty() { - $result = $this->db->isEmpty('plugin'); + $this->db->copyTable('user', 'test_is_empty', true, true); + + $result = $this->db->isEmpty('test_is_empty'); $this->assertFalse($result); - // $result = $this->db->isEmpty('comments'); - // $this->assertTrue($result); + $this->db->truncate('test_is_empty'); + + $result = $this->db->isEmpty('test_is_empty'); + $this->assertTrue($result); + + $this->db->dropTable('test_is_empty'); $result = $this->db->isEmpty(); $this->assertFalse($result); @@ -1010,10 +1016,6 @@ abstract class e_db_abstractTest extends \Codeception\Test\Unit ); $this->assertEquals($expected, $actual); - - - //$actual = $this->db->getFieldDefs('userclass_classes'); - //var_dump($actual); } diff --git a/e107_tests/tests/unit/e_mediaTest.php b/e107_tests/tests/unit/e_mediaTest.php index e5633fbac..cad661cb9 100644 --- a/e107_tests/tests/unit/e_mediaTest.php +++ b/e107_tests/tests/unit/e_mediaTest.php @@ -80,11 +80,8 @@ $json = $this->md->processAjaxImport($file,$var['param']); $result = json_decode($json, JSON_PRETTY_PRINT); - // var_dump($result); $this->assertNotFalse($result); - // var_dump($result); - $this->assertStringEndsWith('/'.basename($var['file']), $result['result']); $this->assertNotEmpty($result['preview']); diff --git a/e107_tests/tests/unit/e_menu_layoutTest.php b/e107_tests/tests/unit/e_menu_layoutTest.php index 9b1dc15c4..bfbed2861 100644 --- a/e107_tests/tests/unit/e_menu_layoutTest.php +++ b/e107_tests/tests/unit/e_menu_layoutTest.php @@ -166,8 +166,6 @@ $expectedLength = $length; $actualLength = strlen($content); - //var_dump($key. " = ".$actualLength); - $this->assertEquals($expectedLength, $actualLength, $key. " is different"); } diff --git a/e107_tests/tests/unit/e_parseTest.php b/e107_tests/tests/unit/e_parseTest.php index 741456990..dee0dde1b 100644 --- a/e107_tests/tests/unit/e_parseTest.php +++ b/e107_tests/tests/unit/e_parseTest.php @@ -1062,8 +1062,6 @@ while($row = $sql->fetch()) $html = "

My paragraph bold

"; $result = $this->tp->htmlwrap($html, 20); - - var_dump($result); }*/ public function testToRss() @@ -1118,7 +1116,6 @@ while($row = $sql->fetch()) if(!empty($errors)) { - var_dump($errors); codecept_debug($errors); } @@ -2201,8 +2198,6 @@ while($row = $sql->fetch()) { $this->assertStringContainsString($str, $result, "Failed on index #".$index); } - //var_dump($result); - } @@ -2233,7 +2228,6 @@ while($row = $sql->fetch()) { $result = $this->tp->toIcon($var['input'],$var['parms']); $this->assertStringContainsString($var['expected'],$result); - //var_dump($result); } } diff --git a/e107_tests/tests/unit/e_parse_shortcodeTest.php b/e107_tests/tests/unit/e_parse_shortcodeTest.php index 65143ce1e..5a738ce3a 100644 --- a/e107_tests/tests/unit/e_parse_shortcodeTest.php +++ b/e107_tests/tests/unit/e_parse_shortcodeTest.php @@ -16,6 +16,10 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit * @var e_render */ private $original_e_render; + /** + * @var e_date + */ + private $original_e_date; public function _before() { @@ -36,11 +40,18 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit $this->original_e_render = e107::getRender(); $mock_e_render = $this->make('e_render'); e107::setRegistry('core/e107/singleton/e_render', $mock_e_render); + + $this->original_e_date = e107::getDate(); + $mock_e_date = $this->make('e_date', [ + 'computeLapse' => 'E107_TEST_STUBBED_OUT' + ]); + e107::setRegistry('core/e107/singleton/e_date', $mock_e_date); } public function _after() { e107::setRegistry('core/e107/singleton/e_render', $this->original_e_render); + e107::setRegistry('core/e107/singleton/e_date', $this->original_e_date); } // public function testShortcode_SITELINKS_ALT() @@ -125,7 +136,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit $result = $this->scParser->parseCodes($template, true); $this->assertSame($expected, $result); - + $array = array( 'LINK_TEXT' => 'Content', 'LINK_URL' => '#', @@ -360,7 +371,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit { $this->fail($e->getMessage()); } - + $vars = array( 'link_id' => '6', 'link_name' => 'News', @@ -379,7 +390,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit $sc->__construct(); $sc->setVars($vars); - + $this->processShortcodeMethods($sc); @@ -529,7 +540,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit } $sc->__construct(); - + $vars = array( 'page_id' => '1', 'page_title' => 'Article 1', @@ -727,7 +738,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit { $this->fail($e->getMessage()); } - + $vars = array( 'user_id' => '1', 'user_name' => 'admin', diff --git a/e107_tests/tests/unit/e_themeTest.php b/e107_tests/tests/unit/e_themeTest.php index 7036a1f98..3e0e94b22 100644 --- a/e107_tests/tests/unit/e_themeTest.php +++ b/e107_tests/tests/unit/e_themeTest.php @@ -668,9 +668,6 @@ class e_themeTest extends \Codeception\Test\Unit // { // $res = e_theme::loadLayout('full', 'bootstrap4'); - // var_dump($res); - - // } /* public function testGetThemesMigrations() diff --git a/e107_tests/tests/unit/pluginsTest.php b/e107_tests/tests/unit/pluginsTest.php index a7bbc6f4c..13a2c202e 100644 --- a/e107_tests/tests/unit/pluginsTest.php +++ b/e107_tests/tests/unit/pluginsTest.php @@ -133,6 +133,15 @@ } + public function testSortOrderPeriodUnderscore() + { + $expected = ['banner.php', 'banner_menu.php']; + $input = ['banner_menu.php', 'banner.php']; + + sort($input); + + $this->assertEquals($expected, $input); + } public function testPluginScripts() { @@ -165,6 +174,8 @@ $files = scandir($path); unset($files[0], $files[1]); // . and .. + sort($files); + if(!empty($focus) && !isset($focus[$plug])) { continue; @@ -484,8 +495,6 @@ } $this->assertEmpty($result, $folder." > ".$this_addon." returned error #".$result.$errMsg); - // echo $folder; - // var_dump($result); }