From e177462c901cd29c3e423640a6f538a930c29536 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sat, 9 Dec 2017 00:31:09 +0100 Subject: :white_check_mark: Unit Test for \DBA factory. --- tests/unit/includes/dba/DBATest.php | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tests/unit/includes/dba/DBATest.php (limited to 'tests') diff --git a/tests/unit/includes/dba/DBATest.php b/tests/unit/includes/dba/DBATest.php new file mode 100644 index 000000000..900d13083 --- /dev/null +++ b/tests/unit/includes/dba/DBATest.php @@ -0,0 +1,67 @@ +assertNull(\DBA::$dba); + + $ret = \DBA::dba_factory('server', 'port', 'user', 'pass', 'db', '0'); + $this->assertInstanceOf('dba_pdo', $ret); + $this->assertFalse($ret->connected); + + $this->assertSame('mysql', \DBA::$scheme); + $this->assertSame('schema_mysql.sql', \DBA::$install_script); + $this->assertSame('0001-01-01 00:00:00', \DBA::$null_date); + $this->assertSame('UTC_TIMESTAMP()', \DBA::$utc_now); + $this->assertSame('`', \DBA::$tquot); + } + + public function testDbaFactoryPostgresql() { + $this->assertNull(\DBA::$dba); + + $ret = \DBA::dba_factory('server', 'port', 'user', 'pass', 'db', '1'); + $this->assertInstanceOf('dba_pdo', $ret); + $this->assertFalse($ret->connected); + + $this->assertSame('pgsql', \DBA::$scheme); + $this->assertSame('schema_postgres.sql', \DBA::$install_script); + $this->assertSame('0001-01-01 00:00:00', \DBA::$null_date); + $this->assertSame("now() at time zone 'UTC'", \DBA::$utc_now); + $this->assertSame('"', \DBA::$tquot); + } + +} -- cgit v1.2.3