lasotaartur / phpspec-silex
Test your Silex applications with PhpSpec
Installs: 8 960
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/lasotaartur/phpspec-silex
Requires
- php: ^7.1
- phpspec/phpspec: ^3.0
- silex/silex: ^2.0
This package is not auto-updated.
Last update: 2026-01-11 14:53:42 UTC
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 } }