mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +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;
|
$e107 = $this->e107;
|
||||||
$templates = scandir(e_CORE . "templates");
|
$templates = scandir(e_CORE . "templates");
|
||||||
|
|
||||||
|
// Load these constants before other tests fail because of what this test does:
|
||||||
$e107::loadAdminIcons();
|
$e107::loadAdminIcons();
|
||||||
|
|
||||||
$exclude = array(
|
$exclude = array(
|
||||||
@@ -1357,7 +1358,6 @@ class e107Test extends \Codeception\Test\Unit
|
|||||||
public function testThemeLan()
|
public function testThemeLan()
|
||||||
{
|
{
|
||||||
$result = e107::themeLan(null, 'basic-light');
|
$result = e107::themeLan(null, 'basic-light');
|
||||||
var_dump($result);
|
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
/*
|
/*
|
||||||
@@ -1887,9 +1887,6 @@ class e107Test extends \Codeception\Test\Unit
|
|||||||
|
|
||||||
// $this->e107->prepare_request();
|
// $this->e107->prepare_request();
|
||||||
|
|
||||||
// var_dump($_SERVER['QUEST_STRING']);
|
|
||||||
|
|
||||||
|
|
||||||
// $res = null;
|
// $res = null;
|
||||||
// $this->assertTrue($res);
|
// $this->assertTrue($res);
|
||||||
}
|
}
|
||||||
@@ -2009,12 +2006,10 @@ class e107Test extends \Codeception\Test\Unit
|
|||||||
|
|
||||||
$result = $obj::isInstalled('user');
|
$result = $obj::isInstalled('user');
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
|
|
||||||
$result = $obj::isInstalled('news');
|
$result = $obj::isInstalled('news');
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -116,21 +116,9 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
// clear the table.
|
// clear the table.
|
||||||
|
|
||||||
$sql = e107::getDb();
|
$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');
|
$sql->truncate('user_extended_struct');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Add a field of each type.
|
// Add a field of each type.
|
||||||
foreach($this->structTypes as $k=> $v)
|
foreach($this->structTypes as $k=> $v)
|
||||||
{
|
{
|
||||||
@@ -1124,7 +1112,6 @@
|
|||||||
{
|
{
|
||||||
$data = $this->ue->getFields();
|
$data = $this->ue->getFields();
|
||||||
$this->assertArrayHasKey('text', $data);
|
$this->assertArrayHasKey('text', $data);
|
||||||
// var_dump($data);
|
|
||||||
// $this->assertCount(15, $data);
|
// $this->assertCount(15, $data);
|
||||||
|
|
||||||
$data = $this->ue->getFields(16);
|
$data = $this->ue->getFields(16);
|
||||||
|
@@ -25,12 +25,7 @@
|
|||||||
{
|
{
|
||||||
$result = preg_replace('/[^\w\-:.]/', '', $var['text']); // this pattern used in parts of the admin-ui.
|
$result = preg_replace('/[^\w\-:.]/', '', $var['text']); // this pattern used in parts of the admin-ui.
|
||||||
$this->assertEquals($var['expected'], $result);
|
$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');
|
$input = array('myarray'=>'myvalue');
|
||||||
$result = $this->arrObj->unserialize($input);
|
$result = $this->arrObj->unserialize($input);
|
||||||
$this->assertSame($input, $result);
|
$this->assertSame($input, $result);
|
||||||
|
|
||||||
|
|
||||||
// var_dump($actual);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@@ -851,11 +851,17 @@ abstract class e_db_abstractTest extends \Codeception\Test\Unit
|
|||||||
|
|
||||||
public function testIsEmpty()
|
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);
|
$this->assertFalse($result);
|
||||||
|
|
||||||
// $result = $this->db->isEmpty('comments');
|
$this->db->truncate('test_is_empty');
|
||||||
// $this->assertTrue($result);
|
|
||||||
|
$result = $this->db->isEmpty('test_is_empty');
|
||||||
|
$this->assertTrue($result);
|
||||||
|
|
||||||
|
$this->db->dropTable('test_is_empty');
|
||||||
|
|
||||||
$result = $this->db->isEmpty();
|
$result = $this->db->isEmpty();
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
@@ -1010,10 +1016,6 @@ abstract class e_db_abstractTest extends \Codeception\Test\Unit
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals($expected, $actual);
|
$this->assertEquals($expected, $actual);
|
||||||
|
|
||||||
|
|
||||||
//$actual = $this->db->getFieldDefs('userclass_classes');
|
|
||||||
//var_dump($actual);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -80,11 +80,8 @@
|
|||||||
$json = $this->md->processAjaxImport($file,$var['param']);
|
$json = $this->md->processAjaxImport($file,$var['param']);
|
||||||
|
|
||||||
$result = json_decode($json, JSON_PRETTY_PRINT);
|
$result = json_decode($json, JSON_PRETTY_PRINT);
|
||||||
// var_dump($result);
|
|
||||||
$this->assertNotFalse($result);
|
$this->assertNotFalse($result);
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
|
|
||||||
$this->assertStringEndsWith('/'.basename($var['file']), $result['result']);
|
$this->assertStringEndsWith('/'.basename($var['file']), $result['result']);
|
||||||
|
|
||||||
$this->assertNotEmpty($result['preview']);
|
$this->assertNotEmpty($result['preview']);
|
||||||
|
@@ -166,8 +166,6 @@
|
|||||||
$expectedLength = $length;
|
$expectedLength = $length;
|
||||||
$actualLength = strlen($content);
|
$actualLength = strlen($content);
|
||||||
|
|
||||||
//var_dump($key. " = ".$actualLength);
|
|
||||||
|
|
||||||
$this->assertEquals($expectedLength, $actualLength, $key. " is different");
|
$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>";
|
$html = "<div><p>My paragraph <b>bold</b></p></div>";
|
||||||
|
|
||||||
$result = $this->tp->htmlwrap($html, 20);
|
$result = $this->tp->htmlwrap($html, 20);
|
||||||
|
|
||||||
var_dump($result);
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public function testToRss()
|
public function testToRss()
|
||||||
@@ -1118,7 +1116,6 @@ while($row = $sql->fetch())
|
|||||||
|
|
||||||
if(!empty($errors))
|
if(!empty($errors))
|
||||||
{
|
{
|
||||||
var_dump($errors);
|
|
||||||
codecept_debug($errors);
|
codecept_debug($errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2201,8 +2198,6 @@ while($row = $sql->fetch())
|
|||||||
{
|
{
|
||||||
$this->assertStringContainsString($str, $result, "Failed on index #".$index);
|
$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']);
|
$result = $this->tp->toIcon($var['input'],$var['parms']);
|
||||||
$this->assertStringContainsString($var['expected'],$result);
|
$this->assertStringContainsString($var['expected'],$result);
|
||||||
//var_dump($result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,6 +16,10 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
|||||||
* @var e_render
|
* @var e_render
|
||||||
*/
|
*/
|
||||||
private $original_e_render;
|
private $original_e_render;
|
||||||
|
/**
|
||||||
|
* @var e_date
|
||||||
|
*/
|
||||||
|
private $original_e_date;
|
||||||
|
|
||||||
public function _before()
|
public function _before()
|
||||||
{
|
{
|
||||||
@@ -36,11 +40,18 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
|||||||
$this->original_e_render = e107::getRender();
|
$this->original_e_render = e107::getRender();
|
||||||
$mock_e_render = $this->make('e_render');
|
$mock_e_render = $this->make('e_render');
|
||||||
e107::setRegistry('core/e107/singleton/e_render', $mock_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()
|
public function _after()
|
||||||
{
|
{
|
||||||
e107::setRegistry('core/e107/singleton/e_render', $this->original_e_render);
|
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()
|
// public function testShortcode_SITELINKS_ALT()
|
||||||
@@ -125,7 +136,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
|||||||
|
|
||||||
$result = $this->scParser->parseCodes($template, true);
|
$result = $this->scParser->parseCodes($template, true);
|
||||||
$this->assertSame($expected, $result);
|
$this->assertSame($expected, $result);
|
||||||
|
|
||||||
$array = array(
|
$array = array(
|
||||||
'LINK_TEXT' => 'Content',
|
'LINK_TEXT' => 'Content',
|
||||||
'LINK_URL' => '#',
|
'LINK_URL' => '#',
|
||||||
@@ -360,7 +371,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
|||||||
{
|
{
|
||||||
$this->fail($e->getMessage());
|
$this->fail($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$vars = array(
|
$vars = array(
|
||||||
'link_id' => '6',
|
'link_id' => '6',
|
||||||
'link_name' => 'News',
|
'link_name' => 'News',
|
||||||
@@ -379,7 +390,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
|||||||
|
|
||||||
$sc->__construct();
|
$sc->__construct();
|
||||||
$sc->setVars($vars);
|
$sc->setVars($vars);
|
||||||
|
|
||||||
$this->processShortcodeMethods($sc);
|
$this->processShortcodeMethods($sc);
|
||||||
|
|
||||||
|
|
||||||
@@ -529,7 +540,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sc->__construct();
|
$sc->__construct();
|
||||||
|
|
||||||
$vars = array(
|
$vars = array(
|
||||||
'page_id' => '1',
|
'page_id' => '1',
|
||||||
'page_title' => 'Article 1',
|
'page_title' => 'Article 1',
|
||||||
@@ -727,7 +738,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
|||||||
{
|
{
|
||||||
$this->fail($e->getMessage());
|
$this->fail($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$vars = array(
|
$vars = array(
|
||||||
'user_id' => '1',
|
'user_id' => '1',
|
||||||
'user_name' => 'admin',
|
'user_name' => 'admin',
|
||||||
|
@@ -668,9 +668,6 @@ class e_themeTest extends \Codeception\Test\Unit
|
|||||||
// {
|
// {
|
||||||
// $res = e_theme::loadLayout('full', 'bootstrap4');
|
// $res = e_theme::loadLayout('full', 'bootstrap4');
|
||||||
|
|
||||||
// var_dump($res);
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
// }
|
||||||
/*
|
/*
|
||||||
public function testGetThemesMigrations()
|
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()
|
public function testPluginScripts()
|
||||||
{
|
{
|
||||||
@@ -165,6 +174,8 @@
|
|||||||
$files = scandir($path);
|
$files = scandir($path);
|
||||||
unset($files[0], $files[1]); // . and ..
|
unset($files[0], $files[1]); // . and ..
|
||||||
|
|
||||||
|
sort($files);
|
||||||
|
|
||||||
if(!empty($focus) && !isset($focus[$plug]))
|
if(!empty($focus) && !isset($focus[$plug]))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -484,8 +495,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->assertEmpty($result, $folder." > ".$this_addon." returned error #".$result.$errMsg);
|
$this->assertEmpty($result, $folder." > ".$this_addon." returned error #".$result.$errMsg);
|
||||||
// echo $folder;
|
|
||||||
// var_dump($result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user