ciaranmcnulty/behat-psr7extension 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ciaranmcnulty/behat-psr7extension

Composer 安装命令:

composer require ciaranmcnulty/behat-psr7extension

包简介

README 文档

README

This is a proof of concept to show that Behat can drive a PSR-7 application without going via a webserver

It's currently built by combining:

  • The existing Mink Browserkit driver, that can test a Symfony app
  • The existing Symfony to PSR-7 bridge, to translate requests and resources back and forth

... and integrating into a behat extension

Usage

Install via composer and configure your behat.yml, specifying the php file that will bootstrap the app (see below):

extensions:
  Cjm\Behat\Psr7Extension:
    app: %paths.base%/path/to/file.php

You can then also modify your MinkExtension configuration to use the PSR-7 driver, e.g.:

extensions:
Behat\MinkExtension:
  base_url:  'http://localhost'
  sessions:
    default:
      psr7: ~

Because there is no current standard interface for PSR-7-handling apps, you will need to select one of the following supported approaches.

Zend Expressive applications

Your configuration file will need to return your application file, bootstrapped. For example:

$container = require __DIR__ . '/../config/container.php';
return $container->get('Zend\Expressive\Application');

Slim applications

Your configuration file will need to return your application file, bootstrapped. For example:

<?php

$app = new \Slim\App;
// .. any necessary bootstrapping
return $app;

All other PSR-7 applications

As long as you can write a function that takes a request and returns a response, you should be able to test your app. Your configuration file will need to return return a callable with the right signature. For example:

<?php

use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

// bootstrap your application
$app = new My\App();

return function (RequestInterface $request) use ($app) : ResponseInterface
{
    // exercise your application however you normally would
    return $app->handle($request);
};

统计信息

  • 总下载量: 7.68k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 0
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-04-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固