tabbi89/behat-silex-extension
Composer 安装命令:
composer require tabbi89/behat-silex-extension
包简介
Behat extension for silex
README 文档
README
This extension offers an easy way to begin testing Silex applications with Behat. If You are familiar with Symfony2Extension for behat then setup with this extension
will be very simple. Like the extension mentioned above it uses bare Application do it doesn't depend on anything else like Goutte so it is just faster in usage.
On each scenario we have fresh new instance of Application. Extension offers ApplicationDictionary which allows to access Your application.
Installation
composer require behat/behat behat/mink behat/mink-extension tabbi89/behat-silex-extension --dev
Usage
Next, within your project root, create a behat.yml file, and add:
default: extensions: Tabbi89\Behat\SilexExtension: kernel: bootstrap: app/autoload.php class: Tabbi89\Behat\SilexExtension\Tests\TestApp\App\Application env: test debug: true testSession: true Behat\MinkExtension: default_session: silex sessions: silex: silex: ~
Here, is where we reference the Silex extension, and tell Behat to use it as our default session. Extension allows some basic configuration values
which will be passed to Your application (env, debug, testSession)
If You want to use extension with Your file as main point:
default: extensions: Tabbi89\Behat\SilexExtension: kernel: bootstrap: app/autoload.php path: app/Application.php env: test debug: true testSession: true Behat\MinkExtension: default_session: silex sessions: silex: silex: ~
If You have more questions about application looks check examples in tests/app/* and configuration tests/behat.yml.dist
ApplicationDictionary
Just include ApplicationDictionary trait in Your FeatureContext to access Your application:
use Behat\Behat\Context; use Behat\Behat\Context\SnippetAcceptingContext; use Tabbi89\Behat\SilexExtension\Context\ApplicationAwareContext; use Tabbi89\Behat\SilexExtension\Context\ApplicationDictionary; class FeatureContext implements SnippetAcceptingContext, ApplicationAwareContext { use ApplicationDictionary; /** * @Given I setup application */ public function iSetupApplication() { $session = $this->getService('session'); $application = $this->getApp(); // ... } }
License
This bundle is under the MIT license.
统计信息
- 总下载量: 1.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-12-31