Example #1
0
	protected function setUp() {
		include(__DIR__ . '/../../config.php');
		$db  = $config['mysql_db'];
		$settings = new Settings($db);
		$database = $settings->getDatabase();
		$settings->setDatabase(null);
		$this->connection = new Connection_MySQL($settings);
		$this->connection->query("DROP DATABASE IF EXISTS $database;"); 
		$this->connection->query("CREATE DATABASE $database;");
		$this->connection->query("USE $database;");
		$settings->setDatabase($database);
		$this->connection->query("CREATE TABLE cat (
			id INTEGER PRIMARY KEY AUTO_INCREMENT,
			name VARCHAR(50),
			colour VARCHAR(50)
		) ENGINE=InnoDB");
		$this->connection->query("INSERT INTO cat (name, colour) VALUES (?, ?)", array("Simon's Cat", 'black'));
		$this->connection->query("INSERT INTO cat (name, colour) VALUES (?, ?)", array("Garfield", 'ginger'));
	}
Example #2
0
 public function testClearPassword() {
 	$password = '******';
 	$settings = new Settings("mysql://*****:*****@localhost/db");
 	$this->assertEquals($settings->getPassword(), $password);
 	$settings->clearPassword();
 	$this->assertNotEquals($settings->getPassword(), $password);
 }