當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FixtureBuilder::truncateTable方法代碼示例

本文整理匯總了PHP中FixtureBuilder::truncateTable方法的典型用法代碼示例。如果您正苦於以下問題:PHP FixtureBuilder::truncateTable方法的具體用法?PHP FixtureBuilder::truncateTable怎麽用?PHP FixtureBuilder::truncateTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FixtureBuilder的用法示例。


在下文中一共展示了FixtureBuilder::truncateTable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDBConfigValues

 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");
 }
開發者ID:jkuehl-carecloud,項目名稱:ThinkUp,代碼行數:33,代碼來源:TestOfConfig.php

示例2: testTruncateTable

 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');
 }
開發者ID:randomecho,項目名稱:ThinkUp,代碼行數:20,代碼來源:TestOfFixtureBuilder.php


注:本文中的FixtureBuilder::truncateTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。