dof-dss/nidirect-migrations

为NI Direct提供的Drupal迁移API模块

安装次数: 3,905

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 7

分支: 1

类型:drupal-module

1.0.0 2021-06-29 18:51 UTC

README

CircleCI

如果您更新了迁移配置,请确保将配置导出到DRUPAL/CONFIG/SYNC目录并提交

迁移

运行迁移

  1. 如果您需要删除网站上的现有内容,请使用命令lando drush mig-purge
  2. 确保已启用Drupal迁移模块(migrate, migrate_plus, migrate_tools)。
  3. 执行'git pull'以确保您有最新的提交。
  4. 启用所需的NIDirect迁移模块。
  5. 将NIDirect Drupal 7数据库导入到Lando的drupal7db数据库。
  6. 将NIDirect Drupal 7文件添加到/imports/files/sites/default/files/
  7. 确保“Migrate NIDirect Utils”已启用,并运行lando drush mig-prep以在D7数据库上执行站点-uuid同步和迁移前任务。
  8. 使用“drush cim”导入站点配置。
  9. 使用lando mist显示迁移状态
  10. 使用lando miip --group=<group name>lando miip <individual migration>

迁移顺序

通常在生产环境中不会运行斜体字中的项。

使用以下内容运行lando miip --group=<group name>

  • migrate_drupal_7_user
  • migrate_drupal_7_file
  • migrate_drupal_7_taxo
  • migrate_nidirect_node_driving_instructor
  • migrate_nidirect_entity_gp
  • migrate_nidirect_node_application
  • migrate_nidirect_node_article
  • migrate_nidirect_node_external_link
  • migrate_nidirect_node_gp_practice
  • migrate_nidirect_node_health_condition
  • migrate_nidirect_node_landing_page
  • migrate_nidirect_node_news
  • migrate_nidirect_node_contact
  • migrate_nidirect_node_nidirect_contact
  • migrate_nidirect_node_page
  • migrate_nidirect_node_publication
  • migrate_drupal_7_link

然后运行以下单个迁移

  • node_contact
  • miip nidirect_book

运行测试

自动测试分为不同的类别:静态分析、单元测试和功能测试。

静态分析

项目使用PHPCS验证所有自定义代码与Drupal.org编码标准的一致性;包括迁移模块和自定义主题。

为了方便,可以在Lando本地开发中使用它:lando phpcs

单元测试

使用PHPUnit时,将检查实现单元测试的任何自定义代码。

对于本地工作,使用lando phpunit调用它。这充当本地工具包装器,用于简化对drupal8/phpcs.sh脚本的调用。

功能测试

使用在本地容器中运行的headless Chromedriver浏览器测试迁移和关键用户活动和旅程。Drupal Core已采用nightwatch.js作为其功能测试工具。我们使用与Drupal Core相同的配置文件,可以通过指定测试套件标签参数来运行任何nightwatch.js测试(核心、贡献或自定义),例如

lando nightwatch --skiptags core:运行除带有core标签的测试之外的所有测试。lando nightwatch --tag nidirect-migrate:运行带有nidirect-migrate标签的所有测试。lando nightwatch /path/to/your/test/file.js:运行单个文件中的特定测试集。

环境变量

一些测试使用环境变量来防止将可能敏感的值直接设置到测试代码中。这些变量的设置方法会因环境而异,但如果你在本地开发中使用Lando,你可以在以下位置找到它们:

/config/drupal.env

如果你需要更改此文件,你还需要重新构建你的本地应用服务器服务:lando rebuild -s appserver

NightWatchJS 测试

将包含的 'D7_Migrate_View' 视图导入现有的Drupal 7 NI Direct站点,并将 TEST_D7_URL 环境变量更新为站点的URL。此视图包含大多数迁移实体的XML数据导出显示,路径指定为 /migrate/(见每个测试中的 'before' 钩子以获取完整路径)。每个显示将返回一个随机实体,但可以在测试中通过将ID追加到URL末尾来覆盖,例如:/migrate/recipe/5012