<?php use Kicaj\Schema\Schema; use Kicaj\DbKit\DbConnect; use Kicaj\DbKit\DbConnector; $config = [Schema::CONFIG_KEY_CONNECTION => DbConnect::getCfg(DbConnector::DB_DRIVER_MYSQL, '127.0.0.1', 'testUser', 'unitTestPass', 'test', '3306'), Schema::CONFIG_KEY_EXPORT_FORMAT => Schema::FORMAT_PHP_ARRAY, Schema::CONFIG_KEY_AINE => true, Schema::CONFIG_KEY_OUTPUT_FILE => 'schema.php']; return $config;
/** * Returns database configuration. * * @param string $testDbName The name of database connection details form phpunit.xml. * @param bool $connect Set to true to connect to database right away. * @param bool $debug Set to true to put database driver in debug mode. * * @return array */ public static function dbGetConfig($testDbName, $connect = true, $debug = true) { $timezone = isset($GLOBALS['TEST_DB_' . $testDbName . '_TIMEZONE']) ? $GLOBALS['TEST_DB_' . $testDbName . '_TIMEZONE'] : ''; return DbConnect::getCfg($GLOBALS['TEST_DB_' . $testDbName . '_DRIVER'], $GLOBALS['TEST_DB_' . $testDbName . '_HOST'], $GLOBALS['TEST_DB_' . $testDbName . '_USERNAME'], $GLOBALS['TEST_DB_' . $testDbName . '_PASSWORD'], $GLOBALS['TEST_DB_' . $testDbName . '_DATABASE'], $GLOBALS['TEST_DB_' . $testDbName . '_PORT'], $connect, $timezone, $debug); }
/** * @covers ::getDriver */ public function test_getDriver() { $cfg = DbConnect::getCfg(DbConnector::DB_DRIVER_MYSQL, 'localhost', 'testUser', 'testPass', 'testDb', 1234); $this->assertSame(DbConnector::DB_DRIVER_MYSQL, DbConnect::getDriver($cfg)); }