public function testDBConfigValues()
 {
     Config::destroyInstance();
     $config = Config::getInstance();
     $this->assertEqual($config->getValue('is_registration_open'), '', "uses default app config value");
     $this->assertFalse($config->getValue('recaptcha_enable'), "uses default app config value");
     $this->assertEqual($config->getValue('recaptcha_private_key'), '', "uses default app config value");
     $this->assertEqual($config->getValue('recaptcha_public_key'), '', "uses default app config value");
     if (isset($_SESSION)) {
         $this->unsetArray($_SESSION);
     }
     $bvalue = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'recaptcha_enable', 'option_value' => 'false');
     $bdata = FixtureBuilder::build('options', $bvalue);
     $this->assertFalse($config->getValue('is_registration_open'), "uses default app config value");
     $this->assertFalse($config->getValue('recaptcha_enable'), "uses db config value");
     $this->assertEqual($config->getValue('recaptcha_private_key'), '', "uses default app config value");
     $this->assertEqual($config->getValue('recaptcha_public_key'), '', "uses default app config value");
     if (isset($_SESSION)) {
         $this->unsetArray($_SESSION);
     }
     FixtureBuilder::truncateTable('options');
     $bvalue['option_value'] = 'true';
     $bvalue2 = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'recaptcha_private_key', 'option_value' => 'abc123');
     $bvalue3 = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'recaptcha_public_key', 'option_value' => 'abc123public');
     $bvalue4 = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'is_registration_open', 'option_value' => 'true');
     $bdata2 = FixtureBuilder::build('options', $bvalue);
     $bdata3 = FixtureBuilder::build('options', $bvalue2);
     $bdata4 = FixtureBuilder::build('options', $bvalue3);
     $bdata5 = FixtureBuilder::build('options', $bvalue4);
     $this->assertTrue($config->getValue('recaptcha_enable'), "uses db config value");
     $this->assertEqual($config->getValue('recaptcha_private_key'), 'abc123', "uses db config value");
     $this->assertEqual($config->getValue('is_registration_open'), true, "uses db config value");
 }
 public function testTruncateTable()
 {
     // bad table name
     try {
         FixtureBuilder::truncateTable('notable');
         $this->fail("should throw FixtureBuilderException");
     } catch (FixtureBuilderException $e) {
         $this->assertPattern('/Unable to truncate table "tu_notable"/', $e->getMessage());
     }
     //add a row, query it, and count should be one
     $this->pdo->query(sprintf("insert into %s (test_name, test_id) values ('mary', 1)", $this->test_table));
     $stmt = $this->pdo->query("select count(*) as count from " . $this->test_table);
     $data = $stmt->fetch();
     $this->assertEqual(1, $data['count'], 'we have one row');
     //truncate row, and count should be 0
     FixtureBuilder::truncateTable(self::TEST_TABLE);
     $stmt = $this->pdo->query("select count(*) as count from " . $this->test_table);
     $data = $stmt->fetch();
     $this->assertEqual(0, $data['count'], 'we have a truncated table');
 }