mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
debug test class added. More pdo tests.
This commit is contained in:
138
tests/unit/e107_db_debugTest.php
Normal file
138
tests/unit/e107_db_debugTest.php
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: Wiz
|
||||||
|
* Date: 2/10/2019
|
||||||
|
* Time: 2:21 PM
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class e107_db_debugTest extends \Codeception\Test\Unit
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @var e107_db_debug */
|
||||||
|
protected $dbg;
|
||||||
|
|
||||||
|
protected function _before()
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$this->dbg = $this->make('e107_db_debug');
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
$this->assertTrue(false, "Couldn't load e107_db_debug object");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
public function testShowIf()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testShow_Log()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testShow_Includes()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSave()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testShow_DEPRECATED()
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public function testLog()
|
||||||
|
{
|
||||||
|
|
||||||
|
define('E107_DBG_BASIC', true); // fails , already defined?
|
||||||
|
|
||||||
|
$res = $this->dbg->log('hello world');
|
||||||
|
|
||||||
|
$this->assertTrue($res, 'db_debug->log() method returned false.');
|
||||||
|
|
||||||
|
|
||||||
|
$result = $this->dbg->Show_Log();
|
||||||
|
|
||||||
|
// var_dump($result);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
public function testLogCode()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLogDeprecated()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test__construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testE107_db_debug()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testShow_SQL_Details()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testShow_SC_BB()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testShow_All()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCountLabel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMark_Time()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMark_Query()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testShow_Performance()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testShow_PATH()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDump()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -683,7 +683,8 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
*//*
|
*/
|
||||||
|
|
||||||
public function testBackup()
|
public function testBackup()
|
||||||
{
|
{
|
||||||
$opts = array(
|
$opts = array(
|
||||||
@@ -702,28 +703,41 @@
|
|||||||
$this->assertContains("CREATE TABLE `e107_core_media_cat`", $tmp);
|
$this->assertContains("CREATE TABLE `e107_core_media_cat`", $tmp);
|
||||||
|
|
||||||
|
|
||||||
}*/
|
}
|
||||||
/*
|
/*
|
||||||
public function testDbError()
|
public function testDbError()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public function testGetLastErrorNumber()
|
public function testGetLastErrorNumber()
|
||||||
{
|
{
|
||||||
|
$this->db->select('doesnt_exists');
|
||||||
|
$result = $this->db->getLastErrorNumber();
|
||||||
|
$this->assertEquals("42S02", $result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetLastErrorText()
|
public function testGetLastErrorText()
|
||||||
{
|
{
|
||||||
|
$this->db->select('doesnt_exists');
|
||||||
|
$result = $this->db->getLastErrorText();
|
||||||
|
|
||||||
|
$actual = (strpos($result,"doesn't exist")!== false );
|
||||||
|
|
||||||
|
$this->assertTrue($actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testResetLastError()
|
public function testResetLastError()
|
||||||
{
|
{
|
||||||
|
$this->db->select('doesnt_exists');
|
||||||
|
$this->db->resetLastError();
|
||||||
|
|
||||||
|
$num = $this->db->getLastErrorNumber();
|
||||||
|
$this->assertEquals(0, $num);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
public function testGetLastQuery()
|
public function testGetLastQuery()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user