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


PHP Migration::getInstance方法代码示例

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


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

示例1: testDateImport

 /**
  * Verify that date fields are imported correctly. When no timezone is
  * explicitly provided with the source data, we want the displayed time on the
  * Drupal site to match that in the source data. To validate that, we make
  * sure we have set a consistent timezone at the PHP and Drupal levels, and
  * that the format used on the page is not locale-dependent (no day or month
  * names). Then, we can just look for the desired date/time strings in the
  * node page.
  */
 function testDateImport()
 {
     date_default_timezone_set('America/Los_Angeles');
     variable_set('date_default_timezone', 'America/Los_Angeles');
     variable_set('date_format_medium', 'Y-m-d H:i');
     $migration = Migration::getInstance('DateExample');
     $result = $migration->processImport();
     $this->assertEqual($result, Migration::RESULT_COMPLETED, t('Variety term import returned RESULT_COMPLETED'));
     $rawnodes = node_load_multiple(FALSE, array('type' => 'date_migrate_example'), TRUE);
     $this->assertEqual(count($rawnodes), 2, t('Two sample nodes created'));
     $node = reset($rawnodes);
     $this->drupalGet('/node/' . $node->nid);
     $this->assertText('2011-05-12 19:43', t('Simple date field found'));
     $this->assertText('2011-06-13 18:32 to 2011-07-23 10:32', t('Date range field found'));
     $this->assertText('2011-07-22 12:13', t('Datestamp field found'));
     $this->assertText('2011-08-01 00:00 to 2011-09-01 00:00', t('Datestamp range field found'));
     $this->assertText('2011-11-18 15:00', t('Datetime field with +9 timezone found'));
     $this->assertText('2011-10-30 14:43 to 2011-12-31 17:59', t('Datetime range field with -5 timezone found'));
     $this->assertText('2011-11-25 09:01', t('First date repeat instance found'));
     $this->assertText('2011-12-09 09:01', t('Second date repeat instance found'));
     $this->assertNoText('2011-12-23 09:01', t('Skipped date repeat instance not found'));
     $this->assertText('2012-05-11 09:01', t('Last date repeat instance found'));
     $node = next($rawnodes);
     $this->drupalGet('/node/' . $node->nid);
     $this->assertText('2012-06-21 15:32', t('First date value found'));
     $this->assertText('2012-12-02 11:08', t('Second date value found'));
     $this->assertText('2004-02-03 01:15', t('Start for first date range found'));
     $this->assertText('2005-03-04 22:11', t('End for first date range found'));
     $this->assertText('2014-09-01 17:21', t('Start for second date range found'));
     $this->assertText('2015-12-23 00:01', t('End for first second range found'));
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:40,代码来源:DateMigrateExampleUnitTest.php

示例2: theMigrationHasRunForEntitiesWithIds

 /**
  * @Given /^the "([^"]*)" migration has run for entities with IDs "([^"]*)"$/
  */
 public function theMigrationHasRunForEntitiesWithIds($migration, $eids)
 {
     $options['idlist'] = $eids;
     $options['force'] = TRUE;
     $this->migration = \Migration::getInstance($migration);
     $this->migration->prepareUpdate($options);
     $this->migration->processImport($options);
     $completed = \Migration::RESULT_COMPLETED;
     assertEquals(1, $completed, "The {$migration} migration did not complete.");
 }
开发者ID:promet,项目名称:drupal-behat-extension,代码行数:13,代码来源:MigrationContext.php

示例3: harvestRollback

 /**
  * @AfterScenario @harvest_rollback
  */
 public function harvestRollback(AfterScenarioScope $event)
 {
     $migrations = migrate_migrations();
     $harvest_migrations = array();
     foreach ($migrations as $name => $migration) {
         if (strpos($name, 'dkan_harvest') === 0) {
             $migration = \Migration::getInstance($name);
             $migration->processRollback();
         }
     }
 }
开发者ID:nucivic,项目名称:dkanextension,代码行数:14,代码来源:HarvestSourceContext.php

示例4: foreach

require_once "class/Defines.php";
require_once "class/Conexao.php";
require_once "class/Migration.php";

try{

    // Atribui uma conexão PDO
    $pdo = Conexao::getInstance();

    // Atribui uma instância da classe Migrate, passando como parâmetro a conexão PDO e o nome da tabela
    $dados_antigos = Migration::getInstance($pdo, DB_DADOS_ANTIGOS);
    $produtos = Migration::getInstance($pdo, DB_PRODUTOS);
    $tamanhos = Migration::getInstance($pdo, DB_TAMANHOS);
    $cores = Migration::getInstance($pdo, DB_CORES);
    $produtos_cores = Migration::getInstance($pdo, DB_PRODUTOS_CORES);
    $produtos_tamanhos = Migration::getInstance($pdo, DB_PRODUTOS_TAMANHOS);

    //Chama o método getAll() passando o parametra da tabela que retorna um array de objetos
    $lista_dados_antigos = $dados_antigos->getAll();

    $idProduto = 0;
    $idTamanho = 0;
    $idCor = 0;
    $idProdutoCor = 0;

    //Loop foreach percorre a array para exibir os dados
    foreach ($lista_dados_antigos as $reg):

        // Persistencia Objeto Produtos
        $produtos->setTableName(DB_PRODUTOS);
        $arrayProdutos = array('codigo' => $reg->codigo, 'titulo' => $reg->titulo);
开发者ID:viniciusgoliver,项目名称:ModeloCrud,代码行数:31,代码来源:migracao.php


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