public function testGetters() { $config = \PandaBase\Connection\ConnectionConfiguration::generateConfiguration(["name" => "test_connection", "driver" => "mysql", "dbname" => "phppuli_test", "host" => "127.0.0.1", "user" => "root", "password" => ""]); $this->assertEquals($config->getName(), "test_connection"); $this->assertEquals($config->getHost(), "127.0.0.1"); $this->assertEquals($config->getDbname(), "phppuli_test"); $this->assertEquals($config->getDriver(), "mysql"); $this->assertEquals($config->getUser(), "root"); }
/** * Initializes a connection with the parameters and adds it to manager object. * * @param array $config Configuration setting * @throws ConnectionNotExistsException */ public function initializeConnection(array $config) { $configuration = ConnectionConfiguration::generateConfiguration($config); $numberOfConnection = count($this->connectionInstances); $this->connectionInstances[$configuration->getName()] = new Connection($configuration); if ($numberOfConnection == 0) { $this->setDefault($configuration->getName()); } }
public function __construct() { $this->connection = new \PandaBase\Connection\Connection(\PandaBase\Connection\ConnectionConfiguration::generateConfiguration(["name" => "test_connection", "driver" => "mysql", "dbname" => "phppuli", "host" => "localhost", "user" => "root", "password" => ""])); date_default_timezone_set("Europe/Budapest"); }