ixis/codeception-drupal-variable

此包已被废弃,不再维护。未建议替代包。

一个Codeception模块,允许在测试期间测试和设置Drupal变量

0.3.3 2016-04-04 16:26 UTC

This package is not auto-updated.

Last update: 2020-08-21 20:23:39 UTC


README

#Drupal变量

允许测试Drupal变量的Codeception模块。

例如:

// Assert that the target site has variable "clean_url" set to 1
$I->seeVariable("clean_url", 1);

// Set a variable.
$I->haveVariable("clean_url", 0);

// Delete a variable.
$I->dontHaveVariable("clean_url");

// Retrieve a variable value.
$value = $I->getVariable("clean_url");

有三种访问变量值的方式。

  • 启动 - 启动本地安装的Drupal实例,并使用variable_get/set()。
  • 直接连接 - 使用PDO直接查询数据库。
  • Drush - 使用drush获取/设置变量。

#安装

使用composer安装,使用git仓库(目前)。

"require": {
    "ixis/codeception-drupal-variable": "~0.3"
}

#配置

将'DrupalVariable'模块添加到套件配置中。

class_name: AcceptanceTester
modules:
    enabled:
        - DrupalVariable

##启动

DrupalVariable:
  class: Codeception\Module\Drupal\Variable\VariableStorage\Bootstrapped

必需的配置变量

  • drupal_root。这是您想要设置/获取变量的本地Drupal站点实例的路径。
    • 例如:/home/sites/www.example.com

##直接连接到数据库

DrupalVariable:
  class: Codeception\Module\Drupal\Variable\VariableStorage\DirectConnection

必需的配置变量

  • dsn - Drupal站点数据库实例的dsn。
    • 例如:mysql:host=localhost;dbname=drupal
  • user - 数据库用户
  • password - 数据库密码

##Drush

DrupalVariable:
  class: Codeception\Module\Drupal\Variable\VariableStorage\Drush

必需的配置变量

  • drush_alias - 测试站点的drush别名。
    • 例如:@mysite.local