未加星标

Zend Framework 2 Behat

字体大小 | |
[开发(php) 所属分类 开发(php) | 发布者 店小二05 | 时间 2018 | 作者 红领巾 ] 0人收藏点击收藏

Is there some tutorial or example on how to configure Behat with Zend Framework 2? I have tried for two days but I cannot figure it out.

Any help would be appreciated. I am trying to do BDD with Zend Framework 2.

EDIT:

Basically, I am running into issues when trying to install Behat through composer. This is my composer.json:

{ "name": "bla", "description": "Bla", "minimum-stability": "dev", "require": { php": ">=5.4", "zendframework/zendframework": "2.*", "doctrine/doctrine-module": "dev-master", "doctrine/doctrine-orm-module": "0.*", "gedmo/doctrine-extensions": "dev-master" }, "require-dev": { "phpunit/phpunit": "3.7.*", "behat/behat": "2.4.*@stable" } }

When I run:

php composer.phar update --dev

I get:

php composer.phar update --dev Loading composer repositories with package information Updating dependencies - Updating gedmo/doctrine-extensions dev-master (fbf4a3 => 3033d7) Checking out 3033d7ecc6633b20bec3e9bcc2336219f3818068 Loading composer repositories with package information Updating dev dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Conclusion: don't install behat/behat v2.4.4 - Conclusion: don't install behat/behat v2.4.3 - Conclusion: don't install behat/behat v2.4.2 - Conclusion: don't install behat/behat v2.4.1 - Conclusion: remove doctrine/common dev-master - symfony/symfony 2.0.7 requires doctrine/common 2.1.* -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev. - symfony/symfony 2.0.x-dev requires doctrine/common >=2.1,<2.3-dev -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev, doctrine/common 2.2.0, doctrine/common 2.2.0-RC1, doctrine/common 2.2.0-RC3, doctrine/common 2.2.0-RC4, doctrine/common 2.2.0-RC5, doctrine/common 2.2.0BETA1, doctrine/common 2.2.0BETA2, doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev. - symfony/symfony v2.0.10 requires doctrine/common 2.1.* -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev. - symfony/symfony v2.0.11 requires doctrine/common 2.1.* -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev. - symfony/symfony v2.0.12 requires doctrine/common 2.1.* -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev. - symfony/symfony v2.0.13 requires doctrine/common 2.1.* -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev. - symfony/symfony v2.0.14 requires doctrine/common 2.1.* -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev. - symfony/symfony v2.0.15 requires doctrine/common >=2.1,<2.3-dev -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev, doctrine/common 2.2.0, doctrine/common 2.2.0-RC1, doctrine/common 2.2.0-RC3, doctrine/common 2.2.0-RC4, doctrine/common 2.2.0-RC5, doctrine/common 2.2.0BETA1, doctrine/common 2.2.0BETA2, doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev. - symfony/symfony v2.0.16 requires doctrine/common >=2.1,<2.3-dev -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev, doctrine/common 2.2.0, doctrine/common 2.2.0-RC1, doctrine/common 2.2.0-RC3, doctrine/common 2.2.0-RC4, doctrine/common 2.2.0-RC5, doctrine/common 2.2.0BETA1, doctrine/common 2.2.0BETA2, doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev. - symfony/symfony v2.0.17 requires doctrine/common >=2.1,<2.3-dev -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev, doctrine/common 2.2.0, doctrine/common 2.2.0-RC1, doctrine/common 2.2.0-RC3, doctrine/common 2.2.0-RC4, doctrine/common 2.2.0-RC5, doctrine/common 2.2.0BETA1, doctrine/common 2.2.0BETA2, doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev. - symfony/symfony v2.0.18 requires doctrine/common >=2.1,<2.3-dev -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev, doctrine/common 2.2.0, doctrine/common 2.2.0-RC1, doctrine/common 2.2.0-RC3, doctrine/common 2.2.0-RC4, doctrine/common 2.2.0-RC5, doctrine/common 2.2.0BETA1, doctrine/common 2.2.0BETA2, doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev. - symfony/symfony v2.0.9 requires doctrine/common 2.1.* -> satisfiable by doctrine/common 2.1.3, doctrine/common 2.1.4, doctrine/common 2.1.x-dev. - symfony/symfony 2.1.x-dev requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - symfony/symfony dev-master requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - symfony/symfony 2.2.x-dev requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - symfony/symfony v2.1.0 requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - symfony/symfony v2.1.0-BETA1 requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - symfony/symfony v2.1.0-BETA2 requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - symfony/symfony v2.1.0-BETA3 requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - symfony/symfony v2.1.0-BETA4 requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - symfony/symfony v2.1.0-RC1 requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - symfony/symfony v2.1.0-RC2 requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - symfony/symfony v2.1.1 requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - symfony/symfony v2.1.2 requires doctrine/common >2.2,<2.4-dev -> satisfiable by doctrine/common 2.2.1, doctrine/common 2.2.2, doctrine/common 2.2.3, doctrine/common 2.2.x-dev, doctrine/common 2.3.0, doctrine/common 2.3.0-BETA1, doctrine/common 2.3.0-RC1, doctrine/common 2.3.0-RC2, doctrine/common 2.3.0-RC3, doctrine/common 2.3.x-dev. - Can only install one of: doctrine/common dev-master, doctrine/common 2.1.3. - Can only install one of: doctrine/common dev-master, doctrine/common 2.1.4. - Can only install one of: doctrine/common dev-master, doctrine/common 2.1.x-dev. - Can only install one of: doctrine/common dev-master, doctrine/common 2.2.0. - Can only install one of: doctrine/common dev-master, doctrine/common 2.2.0-RC1. - Can only install one of: doctrine/common dev-master, doctrine/common 2.2.0-RC3. - Can only install one of: doctrine/common dev-master, doctrine/common 2.2.0-RC4. - Can only install one of: doctrine/common dev-master, doctrine/common 2.2.0-RC5. - Can only install one of: doctrine/common dev-master, doctrine/common 2.2.0BETA1. - Can only install one of: doctrine/common dev-master, doctrine/common 2.2.0BETA2. - Can only install one of: doctrine/common dev-master, doctrine/common 2.2.1. - Can only install one of: doctrine/common dev-master, doctrine/common 2.2.2. - Can only install one of: doctrine/common dev-master, doctrine/common 2.2.3. - Can only install one of: doctrine/common dev-master, doctrine/common 2.2.x-dev. - Can only install one of: doctrine/common dev-master, doctrine/common 2.3.0. - Can only install one of: doctrine/common dev-master, doctrine/common 2.3.0-BETA1. - Can only install one of: doctrine/common dev-master, doctrine/common 2.3.0-RC1. - Can only install one of: doctrine/common dev-master, doctrine/common 2.3.0-RC2. - Can only install one of: doctrine/common dev-master, doctrine/common 2.3.0-RC3. - Can only install one of: doctrine/common dev-master, doctrine/common 2.3.x-dev. - Installation request for doctrine/common dev-master -> satisfiable by doctrine/common dev-master. - Installation request for behat/behat 2.4.*@stable -> satisfiable by behat/behat v2.4.0, behat/behat v2.4.1, behat/behat v2.4.2, behat/behat v2.4.3, behat/behat v2.4.4. - Conclusion: remove symfony/console dev-master|install symfony/symfony 2.0.7|install symfony/symfony 2.0.x-dev|install symfony/symfony 2.1.x-dev|install symfony/symfony v2.0.10|install symfony/symfony v2.0.11|install symfony/symfony v2.0.12|install symfony/symfony v2.0.13|install symfony/symfony v2.0.14|install symfony/symfony v2.0.15|install symfony/symfony v2.0.16|install symfony/symfony v2.0.17|install symfony/symfony v2.0.18|install symfony/symfony v2.0.9|install symfony/symfony v2.1.0|install symfony/symfony v2.1.0-BETA1|install symfony/symfony v2.1.0-BETA2|install symfony/symfony v2.1.0-BETA3|install symfony/symfony v2.1.0-BETA4|install symfony/symfony v2.1.0-RC1|install symfony/symfony v2.1.0-RC2|install symfony/symfony v2.1.1|install symfony/symfony v2.1.2 - behat/behat v2.4.0 requires symfony/console >=2.0.0,<2.2.0-dev -> satisfiable by symfony/console 2.0.4, symfony/console 2.0.5, symfony/console 2.0.6, symfony/console 2.0.7, symfony/console 2.0.x-dev, symfony/console 2.1.x-dev, symfony/console v2.0.10, symfony/console v2.0.12, symfony/console v2.0.13, symfony/console v2.0.14, symfony/console v2.0.15, symfony/console v2.0.16, symfony/console v2.0.17, symfony/console v2.0.18, symfony/console v2.0.9, symfony/console v2.1.0, symfony/console v2.1.0-BETA1, symfony/console v2.1.0-BETA2, symfony/console v2.1.0-BETA3, symfony/console v2.1.0-BETA4, symfony/console v2.1.0-RC1, symfony/console v2.1.0-RC2, symfony/console v2.1.1, symfony/console v2.1.2, symfony/symfony 2.0.7, symfony/symfony 2.0.x-dev, symfony/symfony 2.1.x-dev, symfony/symfony v2.0.10, symfony/symfony v2.0.11, symfony/symfony v2.0.12, symfony/symfony v2.0.13, symfony/symfony v2.0.14, symfony/symfony v2.0.15, symfony/symfony v2.0.16, symfony/symfony v2.0.17, symfony/symfony v2.0.18, symfony/symfony v2.0.9, symfony/symfony v2.1.0, symfony/symfony v2.1.0-BETA1, symfony/symfony v2.1.0-BETA2, symfony/symfony v2.1.0-BETA3, symfony/symfony v2.1.0-BETA4, symfony/symfony v2.1.0-RC1, symfony/symfony v2.1.0-RC2, symfony/symfony v2.1.1, symfony/symfony v2.1.2. - Can only install one of: symfony/console dev-master, symfony/console 2.0.4. - Can only install one of: symfony/console dev-master, symfony/console 2.0.5. - Can only install one of: symfony/console dev-master, symfony/console 2.0.6. - Can only install one of: symfony/console dev-master, symfony/console 2.0.7. - Can only install one of: symfony/console dev-master, symfony/console 2.0.x-dev. - Can only install one of: symfony/console dev-master, symfony/console 2.1.x-dev. - Can only install one of: symfony/console v2.0.10, symfony/console dev-master. - Can only install one of: symfony/console v2.0.12, symfony/console dev-master. - Can only install one of: symfony/console v2.0.13, symfony/console dev-master. - Can only install one of: symfony/console v2.0.14, symfony/console dev-master. - Can only install one of: symfony/console v2.0.15, symfony/console dev-master. - Can only install one of: symfony/console v2.0.16, symfony/console dev-master. - Can only install one of: symfony/console v2.0.17, symfony/console dev-master. - Can only install one of: symfony/console v2.0.18, symfony/console dev-master. - Can only install one of: symfony/console v2.0.9, symfony/console dev-master. - Can only install one of: symfony/console v2.1.0, symfony/console dev-master. - Can only install one of: symfony/console v2.1.0-BETA1, symfony/console dev-master. - Can only install one of: symfony/console v2.1.0-BETA2, symfony/console dev-master. - Can only install one of: symfony/console v2.1.0-BETA3, symfony/console dev-master. - Can only install one of: symfony/console v2.1.0-BETA4, symfony/console dev-master. - Can only install one of: symfony/console v2.1.0-RC1, symfony/console dev-master. - Can only install one of: symfony/console v2.1.0-RC2, symfony/console dev-master. - Can only install one of: symfony/console v2.1.1, symfony/console dev-master. - Can only install one of: symfony/console v2.1.2, symfony/console dev-master. - Installation request for symfony/console dev-master -> satisfiable by symfony/console dev-master, symfony/symfony dev-master, symfony/symfony 2.2.x-dev.

The composer json file works fine when I remove the behat line.

EDIT2:

My temporary hacky solution:

"scripts": { "post-update-cmd": [ "rm -rf vendor/Behat", "git clone git://github.com/Behat/Behat.git", "cp composer.phar Behat/composer.phar", "cd Behat && git submodule update --init", "cd Behat && php composer.phar install", "cd Behat && php composer.phar require guzzle/guzzle:3.0.*", "mv Behat vendor/Behat", "ln -sf ../Behat/bin/behat vendor/bin/" ] }

Ryan Weaver just posted slides from the ZendCon about : Behavioral Driven Development with Behat and Zend Framework 2 .

You can jump to the slide 56 to see how to install Behat on ZF2:

Download Composer

$> curl -s http://getcomposer.org/installer | php

Create (or update) composer.json for Behat ( see the doc )

{ "require": { "behat/behat": "2.4.*@stable" }, "minimum-stability": "dev", "config": { "bin-dir": "bin/" } }

Download Behat libraries

$> php composer.phar install

Then launch Behat from console

php bin/behat --help Edit:

You shouldn't put behat into require-dev , try with this composer.json :

{ "name": "bla", "description": "Bla", "minimum-stability": "dev", "require": { "php": ">=5.4", "zendframework/zendframework": "2.*", "doctrine/doctrine-module": "dev-master", "doctrine/doctrine-orm-module": "0.*", "gedmo/doctrine-extensions": "dev-master", "behat/behat": "2.4.*@stable" }, "require-dev": { "phpunit/phpunit": "3.7.*" } }

本文开发(php)相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师

代码区博客精选文章
分页:12
转载请注明
本文标题:Zend Framework 2 Behat
本站链接:https://www.codesec.net/view/621118.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 开发(php) | 评论(0) | 阅读(61)