1

Zend Framework 2 で Behat を構成する方法に関するチュートリアルまたは例はありますか? 2日間試しましたが、わかりません。

どんな助けでも大歓迎です。Zend Framework 2 で BDD を実行しようとしています。

編集:

基本的に、作曲家を介して Behat をインストールしようとすると、問題が発生します。これは私の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"
    }
}

私が実行すると:

php composer.phar update --dev

私は得る:

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.

behat 行を削除すると、composer json ファイルは正常に動作します。

EDIT2:

私の一時的なハックソリューション:

"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/"
    ]
}
4

2 に答える 2

2

Ryan Weaver が ZendCon から、Behat と Zend Framework 2 を使用した行動駆動開発に関するスライドを投稿しました。

スライド 56にジャンプして、 ZF2 に Behat をインストールする方法を確認できます。

  1. コンポーザーをダウンロード

    $> curl -s http://getcomposer.org/installer | php
    
  2. Behat の composer.json を作成 (または更新) します (ドキュメントを参照) 。

    {
        "require": {
            "behat/behat": "2.4.*@stable"
        },
        "minimum-stability": "dev",
        "config": {
            "bin-dir": "bin/"
        }
    }
    
  3. Behat ライブラリをダウンロードする

    $> php composer.phar install
    
  4. 次に、コンソールから Behat を起動します

    php bin/behat --help
    

編集:

behat を に入れるべきではありません。require-devこれを試してください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.*"
    }
}
于 2012-10-25T07:31:17.840 に答える
0

これは最終的に機能します:

{
    "name": "bla",
    "description": "bla",
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.4",
        "symfony/console": ">=2.0.0,<2.2.0-dev",
        "symfony/config": ">=2.0.0,<2.2.0-dev",
        "symfony/dependency-injection": ">=2.0.0,<2.2.0-dev",
        "symfony/event-dispatcher": ">=2.0.0,<2.2.0-dev",
        "symfony/translation": ">=2.0.0,<2.2.0-dev",
        "symfony/yaml": ">=2.0.0,<2.2.0-dev",
        "symfony/finder": ">=2.0.0,<2.2.0-dev",
        "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",
        "guzzle/guzzle": "3.0.*"
    },
    "autoload": {
        "psr-0": {
            "Behat\\Behat": "src/"
        }
    }
}
于 2012-10-31T13:35:10.053 に答える