Thursday, 15 March 2012

symfony2 - is it possible to use PHpspec with behat?, or just PhPunit with behat? (Symfony) -



symfony2 - is it possible to use PHpspec with behat?, or just PhPunit with behat? (Symfony) -

i'm playing little behat these days, thing don't know if can utilize phpspec behat "assert" stuff, 1 readable utilize it. in case i'm using symfony.

if not, how can utilize asserts phpunit in behat. couldn't now, installed phpunit composer, in behat documentation require file, scenario lightly different (they didn't installed using composer, not in vendor directory)

url doc: http://docs.behat.org/quick_intro.html#more-about-features

, require_once little elegant.

any idea?, answer?, thanks!

you can utilize bahat phpunit. didn't seek phpspec, i'm it's possible if can access logic performs assertions. typically test framework expose logic "outside users".

/** * @then /^the magic should happen$/ */ public function assertunicornsexist() { // create standard assertions through static calls… phpunit_framework_testcase::asserttrue(true); }

not sure total image regards installation, if you're using composer can configure "autoload" part include sources , contexts (if separate). mine works pretty much out of box:

{ "require": { "behat/behat": "dev-master", "behat/mink": "dev-master", "behat/mink-extension": "dev-master", "behat/mink-browserkit-driver": "dev-master", "behat/mink-goutte-driver": "dev-master", "phpunit/dbunit": "*" }, "autoload": { "psr-0": { "": "src/" } } }

then include vendor/autoload.php. recommend adding in bootstrap run 1 time using @beforesuite hook.

/** * @beforesuite */ public static function setupsuite(beforesuitescope $scope) { // if not bootstrapped already, include bootstrap init'ing autoloader, etc… }

also, if you're starting off behat 3 – docs not there yet, utilize http://behat.readthedocs.org/en/latest/. contain latest essentials , decent examples.

symfony2 phpunit behat phpspec

No comments:

Post a Comment