/** * Test constructor * * @return void */ public function testConstructor() { $db = new \Galette\Core\Db(); $type = $db->type_db; $this->string($type)->isIdenticalTo(TYPE_DB); $dsn = array('TYPE_DB' => TYPE_DB, 'USER_DB' => USER_DB, 'PWD_DB' => PWD_DB, 'HOST_DB' => HOST_DB, 'PORT_DB' => PORT_DB, 'NAME_DB' => NAME_DB); $db = new \Galette\Core\Db($dsn); $is_pg = $db->isPostgres(); $type = $db->type_db; switch (TYPE_DB) { case 'pgsql': $this->boolean($is_pg)->isTrue(); $this->string($type)->isIdenticalTo(\Galette\Core\Db::PGSQL); break; case \Galette\Core\Db::MYSQL: $this->boolean($is_pg)->isFalse(); $this->string($type)->isIdenticalTo(\Galette\Core\Db::MYSQL); break; } $this->exception(function () use($dsn) { $dsn['TYPE_DB'] = 'DOES_NOT_EXISTS'; $db = new \Galette\Core\Db($dsn); }); }