定制 lasotaartur/phpspec-silex 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

lasotaartur/phpspec-silex

最新稳定版本:2.0.0

Composer 安装命令:

composer require --dev lasotaartur/phpspec-silex

包简介

Test your Silex applications with PhpSpec

README 文档

README

phpspec Extension for testing Silex applications.

Installation

Add this to your composer.json:

{
    "require": {
        "lasotaartur/phpspec-silex": "dev-master"
    }
}

then add this to your phpspec.yml:

extensions:
    - PhpSpec\Silex\Extension\SilexExtension

Why this extension?

This extension provides you with a bootstrapped Silex environment when writing your phpspec tests.

Configuration

in your phpspec.yml.

App bootstrap path

By default, the extension will bootstrap your app by looking for app/bootstrap.php.

You can manually specify the path to the bootstrap file, like so:

laravel_extension:
    bootstrap_path: "/your/path/bootstrap.php"

Example of bootstrap.php

<?php

$app = new Silex\Application();

$app->get('/hello/{name}', function ($name) use ($app) {
    return 'Hello '.$app->escape($name);
});

return $app;

Usage

If you want use silex $app extend your specs from PhpSpec\Silex\SilexObjectBehavior.

Example

<?php
namespace spec;

use PhpSpec\Silex\SilexObjectBehavior;

class ProductSpec extends SilexObjectBehavior
{
    function it_let()
    {
        $this->app #this is silex application
    }
}

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-01-26