mirror of
https://github.com/e107inc/e107.git
synced 2025-06-08 11:57:29 +02:00
Added E107_DBG_BASIC constant. More tests added for pdo and debug classes.
This commit is contained in:
parent
17eff8de71
commit
ca133074b8
@ -19,6 +19,7 @@ class Unit extends E107Base
|
|||||||
#$_E107['debug'] = true;
|
#$_E107['debug'] = true;
|
||||||
|
|
||||||
codecept_debug("Loading ".APP_PATH."/class2.php…");
|
codecept_debug("Loading ".APP_PATH."/class2.php…");
|
||||||
|
define('E107_DBG_BASIC', true);
|
||||||
require_once(APP_PATH."/class2.php");
|
require_once(APP_PATH."/class2.php");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,6 @@
|
|||||||
/** @var e107_db_debug */
|
/** @var e107_db_debug */
|
||||||
protected $dbg;
|
protected $dbg;
|
||||||
|
|
||||||
protected function _beforeSuite()
|
|
||||||
{
|
|
||||||
define('E107_DBG_BASIC', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _before()
|
protected function _before()
|
||||||
{
|
{
|
||||||
@ -59,17 +55,13 @@
|
|||||||
|
|
||||||
public function testLog()
|
public function testLog()
|
||||||
{
|
{
|
||||||
|
|
||||||
// fails , already defined?
|
|
||||||
|
|
||||||
$res = $this->dbg->log('hello world');
|
$res = $this->dbg->log('hello world');
|
||||||
|
|
||||||
$this->assertTrue($res, 'db_debug->log() method returned false.');
|
$this->assertTrue($res, 'db_debug->log() method returned false.');
|
||||||
|
|
||||||
|
|
||||||
$result = $this->dbg->Show_Log();
|
$result = $this->dbg->Show_Log();
|
||||||
|
$this->assertContains('e107_db_debugTest->testLog()',$result);
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
public function testLogCode()
|
public function testLogCode()
|
||||||
|
@ -381,33 +381,66 @@
|
|||||||
$this->assertEquals(2,$actual);
|
$this->assertEquals(2,$actual);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
public function testFoundRows()
|
public function testFoundRows()
|
||||||
{
|
{
|
||||||
|
$this->db->debugMode(false);
|
||||||
|
$this->db->select('SQL_CALC_FOUND_ROWS SELECT * FROM #user WHERE user_id = 1');
|
||||||
|
$result = $this->db->foundRows();
|
||||||
|
$this->assertEquals(1, $result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRowCount()
|
public function testRowCount()
|
||||||
{
|
{
|
||||||
|
$this->db->retrieve('plugin', '*');
|
||||||
|
$result = $this->db->rowCount();
|
||||||
|
|
||||||
|
$this->assertGreaterThan(10,$result);
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
public function testDb_Insert()
|
public function testDb_Insert()
|
||||||
{
|
{
|
||||||
$actual = $this->db->db_Insert('tmp', array('tmp_ip' => '127.0.0.1', 'tmp_time' => time(), 'tmp_info' => 'test 2'));
|
$actual = $this->db->db_Insert('tmp', array('tmp_ip' => '127.0.0.1', 'tmp_time' => time(), 'tmp_info' => 'test 2'));
|
||||||
$this->assertTrue($actual);
|
$this->assertTrue($actual);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
public function testReplace()
|
public function testReplace()
|
||||||
{
|
{
|
||||||
|
$insert = array(
|
||||||
|
'gen_id' => 1,
|
||||||
|
'gen_type' => 'whatever',
|
||||||
|
'gen_datestamp' => time(),
|
||||||
|
'gen_user_id' => 1,
|
||||||
|
'gen_ip' => '127.0.0.1',
|
||||||
|
'gen_intdata' => '',
|
||||||
|
'gen_chardata' => ''
|
||||||
|
);
|
||||||
|
|
||||||
|
$result = $this->db->replace('generic', $insert);
|
||||||
|
|
||||||
|
$this->assertNotEmpty($result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDb_Replace()
|
public function testDb_Replace()
|
||||||
{
|
{
|
||||||
|
$insert = array(
|
||||||
|
'gen_id' => 1,
|
||||||
|
'gen_type' => 'whatever',
|
||||||
|
'gen_datestamp' => time(),
|
||||||
|
'gen_user_id' => 1,
|
||||||
|
'gen_ip' => '127.0.0.1',
|
||||||
|
'gen_intdata' => '',
|
||||||
|
'gen_chardata' => ''
|
||||||
|
);
|
||||||
|
|
||||||
|
$result = $this->db->db_Replace('generic', $insert);
|
||||||
|
|
||||||
|
$this->assertNotEmpty($result);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
public function testUpdate()
|
public function testUpdate()
|
||||||
{
|
{
|
||||||
$db = $this->db;
|
$db = $this->db;
|
||||||
@ -442,7 +475,7 @@
|
|||||||
$this->assertFalse($actual);
|
$this->assertFalse($actual);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
public function testDb_Update()
|
public function testDb_Update()
|
||||||
{
|
{
|
||||||
$this->db->delete('tmp', "tmp_ip = '127.0.0.1'");
|
$this->db->delete('tmp', "tmp_ip = '127.0.0.1'");
|
||||||
@ -487,12 +520,18 @@
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
public function testTruncate()
|
public function testTruncate()
|
||||||
{
|
{
|
||||||
|
$this->db->truncate('generic');
|
||||||
|
|
||||||
|
$count = $this->db->count('generic');
|
||||||
|
|
||||||
|
$this->assertEquals(0, $count);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public function testFetch()
|
public function testFetch()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -502,12 +541,13 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public function testCount()
|
public function testCount()
|
||||||
{
|
{
|
||||||
|
$count = $this->db->count('user');
|
||||||
|
$this->assertGreaterThan(0, $count);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
public function testDb_Count()
|
public function testDb_Count()
|
||||||
{
|
{
|
||||||
$result = $this->db->db_Count('user','(*)', 'user_id = 1');
|
$result = $this->db->db_Count('user','(*)', 'user_id = 1');
|
||||||
@ -671,17 +711,19 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public function testIsTable()
|
public function testIsTable()
|
||||||
{
|
{
|
||||||
|
$result = $this->db->isTable('plugin');
|
||||||
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsEmpty()
|
public function testIsEmpty()
|
||||||
{
|
{
|
||||||
|
$result = $this->db->isEmpty('plugin');
|
||||||
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
public function testDb_ResetTableList()
|
public function testDb_ResetTableList()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -691,12 +733,20 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public function testTables()
|
public function testTables()
|
||||||
{
|
{
|
||||||
|
$list = $this->db->tables();
|
||||||
|
|
||||||
|
$present = in_array('banlist', $list);
|
||||||
|
$this->assertTrue($present);
|
||||||
|
|
||||||
|
$list = $this->db->tables('nologs');
|
||||||
|
$present = in_array('admin_log', $list);
|
||||||
|
$this->assertFalse($present);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
public function testDb_CopyRow()
|
public function testDb_CopyRow()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user