diff --git a/codeception.yml b/codeception.yml index 987d66892..4361c1022 100644 --- a/codeception.yml +++ b/codeception.yml @@ -6,6 +6,7 @@ paths: envs: tests/_envs actor_suffix: Tester settings: + shuffle: true bootstrap: _bootstrap.php coverage: enabled: true diff --git a/e107 b/e107 index f5f2212b5..a8d1541b9 160000 --- a/e107 +++ b/e107 @@ -1 +1 @@ -Subproject commit f5f2212b54af8c0c82b464891bee93cc1c2e0b29 +Subproject commit a8d1541b9d059437d7a98cf1c3b652b879ebb7ca diff --git a/tests/unit/e107pluginTest.php b/tests/unit/e107pluginTest.php index 364a0ee4b..3eda8e969 100644 --- a/tests/unit/e107pluginTest.php +++ b/tests/unit/e107pluginTest.php @@ -352,6 +352,12 @@ unset($actual[$unimportant_key]); } + // Filter out cruft from e_LEGACY_MODE database output + foreach ($actual as $key => $value) + { + if (is_int($key)) unset($actual[$key]); + } + $this->assertEquals($expected,$actual); $status = $this->ep->XmlSiteLinks('uninstall',$plugVars); diff --git a/tests/unit/e_db_mysqlTest.php b/tests/unit/e_db_mysqlTest.php index ee46346b4..9fc219529 100644 --- a/tests/unit/e_db_mysqlTest.php +++ b/tests/unit/e_db_mysqlTest.php @@ -28,6 +28,7 @@ $this->fail("Couldn't load e_db_mysql object"); } + define('e_LEGACY_MODE', true); $this->db->__construct(); $this->loadConfig(); @@ -180,11 +181,13 @@ $data = $this->db->retrieve('dblog','dblog_title, dblog_user_id', "dblog_type = ".$log_type. " AND dblog_title = '".$remark ."' "); $expected = array ( - 'dblog_title' => 'e_db_pdoTest', - 'dblog_user_id' => '1', + 'dblog_title' => 'e_db_pdoTest', + 'dblog_user_id' => '1', + 0 => 'e_db_pdoTest', + 1 => '1' ); - $this->assertEquals($data, $expected); + $this->assertEquals($expected, $data); } @@ -205,7 +208,7 @@ public function testRetrieve() { - $expected = array ('user_id' => '1', 'user_name' => 'e107', ); + $expected = array ('user_id' => '1', 'user_name' => 'e107', 0 => '1', 1 => 'e107'); $result = $this->db->retrieve('user', 'user_id, user_name', 'user_id = 1'); $this->assertEquals($expected,$result); @@ -215,7 +218,7 @@ $this->assertEquals($expected,$result); - $expected = array ( 0 => array ( 'user_id' => '1', 'user_name' => 'e107', ),); + $expected = array ( 0 => array ( 'user_id' => '1', 'user_name' => 'e107', 0 => '1', 1 => 'e107'),); $result = $this->db->retrieve('user', 'user_id, user_name', 'user_id = 1', true); $this->assertEquals($expected,$result); @@ -277,7 +280,10 @@ $expected = array( 'tmp_ip' => '127.0.0.1', 'tmp_time' => '12345435', - 'tmp_info' => 'Insert test' + 'tmp_info' => 'Insert test', + 0 => '127.0.0.1', + 1 => '12345435', + 2 => 'Insert test' ); $actual = $this->db->retrieve('tmp', '*','tmp_ip = "127.0.0.1" AND tmp_time = 12345435'); $this->assertEquals($expected, $actual, 'Inserted content doesn\'t match the retrieved content'); @@ -304,8 +310,10 @@ ); $this->db->insert('generic', $insert); - $actual = $this->db->lastInsertId(); - $this->assertEquals(2,$actual); + $first = $this->db->lastInsertId(); + $this->db->insert('generic', $insert); + $next = $this->db->lastInsertId(); + $this->assertEquals(1, $next - $first); } @@ -394,7 +402,10 @@ $expected = array( 'tmp_ip' => '127.0.0.1', 'tmp_time' => '1234568', - 'tmp_info' => 'Update test 3' + 'tmp_info' => 'Update test 3', + 0 => '127.0.0.1', + 1 => '1234568', + 2 => 'Update test 3' ); $actual = $this->db->retrieve('tmp', '*','tmp_ip = "127.0.0.1"'); $this->assertEquals($expected, $actual, 'Test 4: Updated content doesn\'t match the retrieved content'); @@ -500,7 +511,6 @@ $check = (strpos($row[1], "CREATE TABLE `e107_user`") !== false); $this->assertTrue($check); - define('e_LEGACY_MODE', true); $this->db->select('user', '*', 'user_id = 1'); $row = $this->db->db_Fetch(); $this->assertEquals("e107", $row['user_name']); @@ -770,8 +780,13 @@ public function testDb_CopyRow() { - $result = $this->db->db_CopyRow('news', '*', "news_id = 1"); - $this->assertEquals(2,$result); + $count_args = ['news', '(*)', '']; + $copy_args = ['news', '*', 'news_id = 1']; + + $initial_count = $this->db->count(...$count_args); + $this->db->db_CopyRow(...$copy_args); + $next_count = $this->db->count(...$count_args); + $this->assertEquals(1, $next_count - $initial_count); } public function testDb_CopyTable() diff --git a/tests/unit/e_db_pdoTest.php b/tests/unit/e_db_pdoTest.php index e3f17581d..fb405b4cc 100644 --- a/tests/unit/e_db_pdoTest.php +++ b/tests/unit/e_db_pdoTest.php @@ -30,7 +30,7 @@ $this->fail("Couldn't load e_db_pdo object"); } - + define('e_LEGACY_MODE', true); $this->db->__construct(); $this->loadConfig(); @@ -527,7 +527,6 @@ $check = (strpos($row[1], "CREATE TABLE `e107_user`") !== false); $this->assertTrue($check); - define('e_LEGACY_MODE', true); $this->db->select('user', '*', 'user_id = 1'); $row = $this->db->db_Fetch(); $this->assertEquals("e107", $row['user_name']);