kix/behat-sf2-service-generator 问题修复 & 功能扩展

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

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

kix/behat-sf2-service-generator

最新稳定版本:0.1.0

Composer 安装命令:

composer require kix/behat-sf2-service-generator

包简介

Behat Symfony2 service generator

README 文档

README

This is a Behat extension that catches calls to undefined Symfony services and runs PHPSpec to describe them.

Installation

Just run this:

	composer require kix/behat-sf2-service-generator "~0.1" 

And then enable the extension in your behat.yml:

default:
  # ...
  extensions:
    Kix\Symfony2ServiceExtension\Symfony2ServiceExtension: ~

Now, when you try to access a non-existent service, you'll be asked if you want to generate a class for it. A YAML config will be dumped on the console for your convinience, too. Here's a quick peek at what it looks like.

Feature: Generating Symfony services
  Scenario: Creating a service when a ServiceNotFoundException is caught
    When I run behat
    And my step tries to get a service that doesn't exist
    Then a shiny notification is displayed asking if I want to generate it
<?php
class FeatureContext implements Context, SnippetAcceptingContext
{

	// Note I'm using Symfony2Extension here:
    use \Behat\Symfony2Extension\Context\KernelDictionary;

    /**
     * Initializes context.
     *
     * Every scenario gets its own context instance.
     * You can also pass arbitrary arguments to the
     * context constructor through behat.yml.
     */
    public function __construct()
    {
    }

    /**
     * @When I run behat
     */
    public function iRunBehat()
    {
    	// do nothing
    }

    /**
     * @When my step tries to get a service that doesn't exist
     */
    public function myStepTriesToGetAServiceThatDoesnTExist()
    {
        $this->getContainer()->get('my_bundle.kitten_provider');
    }

}

And boom:

Example

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固