chapabu/codeception-drupal-runserver

Codeception 扩展,用于使用 PHP 内置的 web 服务器启动和停止 Drush 服务器。

dev-master 2015-03-02 18:31 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:39:34 UTC


README

Codeception 扩展,用于使用 PHP 内置的 web 服务器和 drush runserver 命令启动和停止 Drush 服务器。

要求

  • Drush
  • PHP 5.4(Drush 服务器支持 PHP 5.3,但我可能不会积极测试。如果需要,欢迎提交 pull request :))

安装

通过 Composer

$ composer require chapabu/codeception-drupal-runserver --dev

用法

paths:
    tests: .
    log: _log
    data: _data
    helpers: _helpers
extensions:
    enabled:
        - Codeception\Extension\DrushRunserver
    config:
        Codeception\Extension\DrushRunserver:
            drupalRoot: docroot
            drushBinary: ../vendor/bin/drush
            hostname: 127.0.0.1
            port: 8080
            variables:
                site_name: My cool site
                theme_default: my_awesome_theme
                site_mail: admin@example.com

配置选项

drupalRoot

drupalRoot: docRoot

您的 Drupal 安装所在的文件夹(相对于您的 codecept.yml 文件)(默认:与 codecept.yml 文件相同的目录)。

drushBinary

drushBinary: ../vendor/bin/drush

您的系统中 Drush 二进制的路径(默认:drush - 好像它是全局安装的)。

hostname

hostname: 127.0.0.1

绑定到服务器的地址(默认:127.0.0.1)。

port

port: 8080

绑定到服务器的端口号(默认:8888)。

variables

variables:
    site_name: My cool site
    theme_default: my_awesome_theme
    site_mail: admin@example.com

要覆盖运行站点的 $conf 数组中的变量的键值数组。

测试

$ codecept run

致谢

此代码的大部分来自 https://github.com/tiger-seo/PhpBuiltinServer,但已重新配置以使用 drush runserver 命令。

许可

MIT 许可证(MIT)。请参阅许可文件以获取更多信息。