当前位置: 首页>>代码示例>>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;未经允许,请勿转载。