herloct / codeception-slim-module
为 Slim 3 微型框架提供的 Codeception 模块。
1.1.0
2017-03-04 20:30 UTC
Requires
- php: ^5.6 || ^7.0
Requires (Dev)
- php: ^5.6 || ^7.0
- codeception/codeception: ^2.2
- slim/slim: ^3.5
This package is not auto-updated.
Last update: 2024-09-14 19:47:48 UTC
README
此模块允许你在 Slim 3 微型框架 中运行测试。
基于 ZendExpressive 模块。
安装
通过命令行
composer require --dev herloct/codeception-slim-module
通过 composer.json
{ "require-dev": { "herloct/codeception-slim-module": "^1.1" } }
配置
将以下内容添加到你的 codeception.yml
modules: config: \Herloct\Codeception\Module\Slim: container: path/to/container.php REST: depends: \Herloct\Codeception\Module\Slim
或者添加到 tests/functional.suite.yml
modules: enabled: - \Helper\Functional - \Herloct\Codeception\Module\Slim: container: path/to/container.php - REST: depends: \Herloct\Codeception\Module\Slim
container
属性是返回你的应用容器的文件的相对路径。
以下是最小的 container.php
内容。
require __DIR__.'/vendor/autoload.php'; use Psr\Container\ContainerInterface; use Slim\App; use Slim\Container; $container = new Container([ App::class => function (ContainerInterface $c) { $app = new App($c); // routes and middlewares here return $app; } ]); return $container;
你可以使用这个 示例项目 作为参考。
API
- app -
\Slim\App
实例 - container -
\Psr\Container\ContainerInterface
实例 - client - BrowserKit 客户端
待办事项
- 除了 REST 之外,添加更多接受/功能测试。