getMessage()."\n".$DB->getUserInfo()."\n"); } $this->assertEquals($tables, $DB->getCol('show tables')); } } class DiogenesDatabaseTest extends PHPUnit_TestCase { function testConstructor() { $DB = new DiogenesDatabase('localhost', 'test', 'test', ''); $this->assertTrue(is_object($DB)); } function testErrors() { $db = new DiogenesDatabase('tst', 'localhost', 'test', ''); $this->assertTrue($db->err()); $this->assertEquals(1049, $db->errno()); $this->assertEquals("Unknown database 'tst'", $db->error()); $db->ResetError(); $this->assertFalse($db->err()); $this->assertEquals(0, $db->errno()); $this->assertEquals('', $db->error()); } function testMoreErrors() { $db = new DiogenesDatabase('test', 'localhost', 'test', ''); $this->assertFalse($db->err(), "Should be no error"); $db->query("SLECT"); $this->assertTrue($db->err(), "Should be error"); $this->assertEquals(1064, $db->errno()); $this->assertEquals("You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SLECT' at line 1", $db->error()); $this->assertEquals("SLECT", $db->errinfo()); $db->ResetError(); $this->assertEquals('', $db->errinfo()); } }