public static function getInstance() { if (is_null(self::$conn)) { self::$conn = new \PDO('mysql:host=' . Config::getHost() . ';dbname=' . Config::getDatabase(), Config::getUsername(), Config::getPassword(), []); } return self::$conn; }
public function __construct($userid = null, $pass = null) { if (!isset($userid) && !isset($pass)) { $config = new Config(); $userid = $config->getUsername(); $pass = $config->getPassword(); } $this->baseUrl = 'http://sso.bhmobile.bhtelecom.ba/'; // izmjena nakon što je BH Telecom izmijenio stranicu $this->actionUrl = '/sso/login'; $this->fields = array(new Field('application', ''), new Field('url', 'http://www.bhmobile.bhtelecom.ba/'), new Field('realm', 'sso'), new Field('userid', $userid), new Field('password', $pass)); }
/** * @return \PDO */ private function connect() { $dsn = Config::getDsn(); $username = Config::getUsername(); $password = Config::getPassword(); try { return new \PDO($dsn, $username, $password); } catch (\PDOException $e) { echo $e->getMessage(); die; } }
/** * @covers Pronamic\Twinfield\Secure\Config::getUsername * @todo Implement testGetUsername(). */ public function testGetUsername() { $this->object->setCredentials('testUsername', 'testPassword', 'testOrganisation', 1001); $this->assertSame($this->object->getUsername(), 'testUsername'); }