Fixes 801687 - Upgrades bouncer database handling to use PDO. Database tests pass. #26

Merged
merged 1 commit into from Mar 27, 2013

2 participants

@brandonsavage

No description provided.

@brandonsavage

@AdrianGaudebert r?

@adngdb adngdb commented on the diff Mar 27, 2013
bouncer/php/functions.php
@@ -188,3 +187,16 @@ function queryForMirrors($sdo, $http_type, $where_lang, $location_id, $client_re
return $mirrors;
}
+
+/**
+ * Get an ID based on name.
+ * @param string $table
+ * @param string $id_col
+ * @param string $name_col
+ * @param string $name
+ */
+function name_to_id($sdo, $table,$id_col,$name_col,$name)
@adngdb
Mozilla member
adngdb added a line comment Mar 27, 2013

Nit: some spaces are missing after commas here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@adngdb adngdb commented on an outdated diff Mar 27, 2013
bouncer/tests/sdo2.php
+
+ function testNoDatabaseonnection() {
+ $this->assertIsA($this->q,'string','Flattened query is a string.');
+
+ $key = md5($this->q.MYSQL_BOTH.null);
+ $this->assertTrue($this->mc->flush(),'Existing cache entries flushed.');
+ $this->assertTrue($this->mc->set($key,'foobar'));
+
+ $buf = $this->sdo->get($this->q, $this->args);
+ $this->assertEqual($buf,'foobar','Get retrieved from cache only.');
+
+ $this->mc->flush();
+ }
+
+ function testConnect() {
+ $this->assertTrue(($this->sdo->connect() instanceof PDO),'SDO connected to the default database successfully.');
@adngdb
Mozilla member
adngdb added a line comment Mar 27, 2013

Isn't assertTrue writing the second argument only when the assertion fails? In which case the messages here are wrong, as when it's printed it is not connecting successfully? Or is it different from Python's assert functions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@adngdb
Mozilla member

r+! And congrats on fixing the unit tests! :)

@brandonsavage brandonsavage Fixes 801687 - Upgrade bouncer database handling
* Implements PDO instead of old mysql_* API
* Adds error handling, raises exceptions on failure
* Adds new tests for new database layer which all pass (YAY!)
* Fixes older tests that rely on old SDO database object.
* Creates mock Memcache object and interface for caching layer.
245c44c
@brandonsavage brandonsavage merged commit e70fb4f into mozilla:master Mar 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment