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:
- 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.
- You can use the
assert*methods these provided byPHPUnit_Framework_Assertdirectly. 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
- Install this extension by composer:
composer require goez/behat-laravel-extension
- Add this extension and mink extension in your
behat.yml:
default: extensions: Goez\BehatLaravelExtension: Behat\MinkExtension: default_session: laravel laravel: ~
- Let your context class extends the
Goez\BehatLaravelExtension\Context\LaravelContextclass:
use Goez\BehatLaravelExtension\Context\LaravelContext; class FeatureContext extends LaravelContext { // ... }
License
MIT
统计信息
- 总下载量: 4.95k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-05