定制 goez/behat-laravel-extension 二次开发

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

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

goez/behat-laravel-extension

最新稳定版本:0.1.0

Composer 安装命令:

composer require goez/behat-laravel-extension

包简介

Enhance Laracasts Behat Laravel Extension

README 文档

README

I like to develop a Laravel application by Behat way. With Laracasts' Behat Laravel Extension, it made my dreams come true.

After I upgraded to Laravel 5.1, I fall in love the testing methods such as seeInDatabase or be in the new testing framework, but I can not use them in Behat context class.

So I combined the Behat-Laravel-Extension and Laravel testing framework, and made this extension.

What does the extension do?

This extension provides two features:

  1. You can use the testing APIs of Laravel Testing in your Behat context class. For example:
   /**
    * @Given a user whose name is :name
    * @param $name
    */
   public function aUserWhoseNameIs($name)
   {
       $this->user = factory(App\User::class)->create([
           'name' => $name,
       ]);
       $this->seeInDatabase('users', [
           'name' => $this->user->name,
       ]);
   }

   /**
    * @When user attempts to sign in
    */
   public function userAttemptsToSignIn()
   {
       $this->be($this->user);
   }

The seeInDatabase, be and other testing methods are provided by Illuminate\Foundation\Testing\ApplicationTrait and only can be used in PHPUnit test case, but you can use them in Behat context class now.

  1. You can use the assert* methods these provided by PHPUnit_Framework_Assert directly. For example:
   /**
    * @Then user should be sign in
    */
   public function userShouldBeSignIn()
   {
       $this->assertTrue(Auth::check());
   }

This extension is still in development. If you have any issues, please let me know.

Installation

  1. Install this extension by composer:
composer require goez/behat-laravel-extension
  1. Add this extension and mink extension in your behat.yml:
default:
    extensions:
        Goez\BehatLaravelExtension:
        Behat\MinkExtension:
            default_session: laravel
            laravel: ~
  1. Let your context class extends the Goez\BehatLaravelExtension\Context\LaravelContext class:
use Goez\BehatLaravelExtension\Context\LaravelContext;

class FeatureContext extends LaravelContext
{
    // ...
}

License

MIT

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-05