Add unit tests for DB class equivalence and magic properties

This commit is contained in:
Kijin Sung 2023-04-30 22:50:49 +09:00
parent 28bc991048
commit 7755821f20

View file

@ -12,10 +12,22 @@ class DBTest extends \Codeception\TestCase\Test
{
$oDB = Rhymix\Framework\DB::getInstance();
$this->assertTrue($oDB instanceof Rhymix\Framework\DB);
$this->assertEquals($oDB, \DB::getInstance());
$this->assertTrue(\DB::getInstance() instanceof \DB);
$this->assertTrue($oDB->isConnected());
$this->assertTrue($oDB->getHandle() instanceof Rhymix\Framework\Helpers\DBHelper);
}
public function testCompatProperties()
{
$oDB = Rhymix\Framework\DB::getInstance();
$this->assertEquals('mysql', $oDB->db_type);
$this->assertEquals($oDB->getHandle()->getAttribute(\PDO::ATTR_SERVER_VERSION), $oDB->db_version);
$this->assertEquals(Rhymix\Framework\Config::get('db.master.prefix'), $oDB->prefix);
$this->assertTrue($oDB->use_prepared_statements);
$this->assertNull($oDB->some_nonexistent_property);
}
public function testPrepare()
{
$oDB = Rhymix\Framework\DB::getInstance();