mirror of
https://github.com/e107inc/e107.git
synced 2025-07-30 19:30:25 +02:00
Merge pull request #4473 from Deltik/fix-tests
Fix failing tests since 2021-01-10
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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()];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -132,10 +132,6 @@ $data = array (
|
||||
$input = array('myarray'=>'myvalue');
|
||||
$result = $this->arrObj->unserialize($input);
|
||||
$this->assertSame($input, $result);
|
||||
|
||||
|
||||
// var_dump($actual);
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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']);
|
||||
|
@@ -166,8 +166,6 @@
|
||||
$expectedLength = $length;
|
||||
$actualLength = strlen($content);
|
||||
|
||||
//var_dump($key. " = ".$actualLength);
|
||||
|
||||
$this->assertEquals($expectedLength, $actualLength, $key. " is different");
|
||||
}
|
||||
|
||||
|
@@ -1062,8 +1062,6 @@ while($row = $sql->fetch())
|
||||
$html = "<div><p>My paragraph <b>bold</b></p></div>";
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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',
|
||||
|
@@ -668,9 +668,6 @@ class e_themeTest extends \Codeception\Test\Unit
|
||||
// {
|
||||
// $res = e_theme::loadLayout('full', 'bootstrap4');
|
||||
|
||||
// var_dump($res);
|
||||
|
||||
|
||||
// }
|
||||
/*
|
||||
public function testGetThemesMigrations()
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user