当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Extensions_Database_DataSet_IDataSet::getTable方法代码示例

本文整理汇总了PHP中PHPUnit_Extensions_Database_DataSet_IDataSet::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Extensions_Database_DataSet_IDataSet::getTable方法的具体用法?PHP PHPUnit_Extensions_Database_DataSet_IDataSet::getTable怎么用?PHP PHPUnit_Extensions_Database_DataSet_IDataSet::getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Extensions_Database_DataSet_IDataSet的用法示例。


在下文中一共展示了PHPUnit_Extensions_Database_DataSet_IDataSet::getTable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addDataSet

 /**
  * Adds a new data set to the composite.
  *
  * The dataset may not define tables that already exist in the composite.
  *
  * @param PHPUnit_Extensions_Database_DataSet_IDataSet $dataSet
  */
 public function addDataSet(PHPUnit_Extensions_Database_DataSet_IDataSet $dataSet)
 {
     foreach ($dataSet->getTableNames() as $tableName) {
         if (!in_array($tableName, $this->getTableNames())) {
             $this->motherDataset->addTable($dataSet->getTable($tableName));
         } else {
             $other = $dataSet->getTable($tableName);
             $table = $this->getTable($tableName);
             if (!$table->getTableMetaData()->matches($other->getTableMetaData())) {
                 throw new InvalidArgumentException("There is already a table named {$tableName} with different table definition");
             }
             $table->addTableRows($dataSet->getTable($tableName));
         }
     }
 }
开发者ID:nathanedwards,项目名称:cowfields.craft,代码行数:22,代码来源:CompositeDataSet.php

示例2: matches

 /**
  * Asserts that the given data set matches this data set.
  *
  * @param PHPUnit_Extensions_Database_DataSet_IDataSet $other
  */
 public function matches(PHPUnit_Extensions_Database_DataSet_IDataSet $other)
 {
     $thisTableNames = $this->getTableNames();
     $otherTableNames = $other->getTableNames();
     sort($thisTableNames);
     sort($otherTableNames);
     if ($thisTableNames != $otherTableNames) {
         return FALSE;
     }
     foreach ($thisTableNames as $tableName) {
         $table = $this->getTable($tableName);
         if (!$table->matches($other->getTable($tableName))) {
             return FALSE;
         }
     }
     return TRUE;
 }
开发者ID:DaveNascimento,项目名称:civicrm-packages,代码行数:22,代码来源:AbstractDataSet.php

示例3: assertEquals

 /**
  * Asserts that the given data set matches this data set.
  *
  * @param PHPUnit_Extensions_Database_DataSet_IDataSet $other
  */
 public function assertEquals(PHPUnit_Extensions_Database_DataSet_IDataSet $other)
 {
     $thisTableNames = $this->getTableNames();
     $otherTableNames = $other->getTableNames();
     sort($thisTableNames);
     sort($otherTableNames);
     if ($thisTableNames != $otherTableNames) {
         throw new Exception("Expected following tables: " . implode(', ', $thisTableNames) . "; has columns: " . implode(', ', $otherTableNames));
     }
     foreach ($thisTableNames as $tableName) {
         $this->getTable($tableName)->assertEquals($other->getTable($tableName));
     }
     return TRUE;
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:19,代码来源:AbstractDataSet.php

示例4: loadDataSet

    /**
     * Load date into moodle database tables from standard PHPUnit data set.
     *
     * Note: it is usually better to use data generators
     *
     * @param PHPUnit_Extensions_Database_DataSet_IDataSet $dataset
     * @return void
     */
    protected function loadDataSet(PHPUnit_Extensions_Database_DataSet_IDataSet $dataset) {
        global $DB;

        $structure = phpunit_util::get_tablestructure();

        foreach($dataset->getTableNames() as $tablename) {
            $table = $dataset->getTable($tablename);
            $metadata = $dataset->getTableMetaData($tablename);
            $columns = $metadata->getColumns();

            $doimport = false;
            if (isset($structure[$tablename]['id']) and $structure[$tablename]['id']->auto_increment) {
                $doimport = in_array('id', $columns);
            }

            for($r=0; $r<$table->getRowCount(); $r++) {
                $record = $table->getRow($r);
                if ($doimport) {
                    $DB->import_record($tablename, $record);
                } else {
                    $DB->insert_record($tablename, $record);
                }
            }
            if ($doimport) {
                $DB->get_manager()->reset_sequence(new xmldb_table($tablename));
            }
        }
    }
开发者ID:rwijaya,项目名称:moodle,代码行数:36,代码来源:advanced_testcase.php


注:本文中的PHPUnit_Extensions_Database_DataSet_IDataSet::getTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。