【问题标题】:Installing Behat via Pear on Mac Os X Problems在 Mac OS X 问题上通过 Pear 安装 Behat
【发布时间】:2013-04-16 14:43:17
【问题描述】:

我正在使用以下 turotiral 在我的美洲狮 macbook 上安装 behat 和 mink。

http://www.ifusio.com/blog/how-to-install-behat-mink-on-mac-osx

在你运行 behat 命令之前一切似乎都很好,然后我收到以下错误

PHP Fatal error:  Class 'Symfony\Component\Console\Helper\ProgressHelper' not found in /Users/waseem/pear/share/pear/Symfony/Component/Console/Application.php on line 966
PHP Stack trace:
PHP   1. {main}() /Users/waseem/pear/bin/behat:0
PHP   2. Behat\Behat\Console\BehatApplication->__construct() /Users/waseem/pear/bin/behat:26
PHP   3. Symfony\Component\Console\Application->__construct() /Users/waseem/pear/share/pear/behat/src/Behat/Behat/Console/BehatApplication.php:32
PHP   4. Symfony\Component\Console\Application->getDefaultHelperSet() /Users/waseem/pear/share/pear/Symfony/Component/Console/Application.php:75

Fatal error: Class 'Symfony\Component\Console\Helper\ProgressHelper' not found in /Users/waseem/pear/share/pear/Symfony/Component/Console/Application.php on line 966

Call Stack:
    0.0002     632656   1. {main}() /Users/waseem/pear/bin/behat:0
    0.0036    1350424   2. Behat\Behat\Console\BehatApplication->__construct() /Users/waseem/pear/bin/behat:26
    0.0036    1350504   3. Symfony\Component\Console\Application->__construct() /Users/waseem/pear/share/pear/behat/src/Behat/Behat/Console/BehatApplication.php:32
    0.0036    1350816   4. Symfony\Component\Console\Application->getDefaultHelperSet() /Users/waseem/pear/share/pear/Symfony/Component/Console/Application.php:75

如果我通过 Github 方法安装它,一切似乎都很好,这只是困扰我为什么会发生这种情况。我的机器上没有 Symfony。

也许是因为我安装了 --alldeps ?我已经尝试卸载并再次尝试同样的问题

【问题讨论】:

    标签: macos behat


    【解决方案1】:

    Behat PEAR channel 不再维护。那里没有最新的 Behat 版本 (>=2.4)。

    安装 Behat 最好和最简单的方法是使用 composer。我建议关注the original docs。那里不再列出梨方法。

    【讨论】:

    • 在使用 Composer 时仍然会发生这种情况。
    • 如果你已经全局安装了 behat,并且在你的共享文件夹中安装了 Symfony,你必须在你的项目文件夹中指定本地 behat 可执行文件。因此,从快速入门文档中,ls_project../bin/behat --init
    【解决方案2】:

    谢谢你,但是我在 Mac OS X 上可靠地为我工作的唯一方法是使用 .phar 安装方法。

    composer 方法虽然看起来更简单,但在遵循

    中的指南时不断产生错误

    http://docs.behat.org/cookbook/behat_and_mink.html

    我得到的错误如下,所以我坚持使用 phar 文件。

      [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]                                                       
      Unable to parse file "/Users/waseem/Behat/vendor/behat/mink-extension/src/Behat/MinkExtension/services/sessions/selenium2.xml".  
    
    
    
    
    
    
      [InvalidArgumentException]                                                                                                                                                                                                                                         
      [ERROR 1840] Element '{http://symfony.com/schema/dic/services}parameter', attribute 'type': [facet 'enumeration'] The value 'integer' is not an element of the set {'collection', 'service', 'string', 'constant'}. (in /Users/waseem/Behat/ - line 20, column 0)  
      [ERROR 1824] Element '{http://symfony.com/schema/dic/services}parameter', attribute 'type': 'integer' is not a valid value of the atomic type '{http://symfony.com/schema/dic/services}parameter_type'. (in /Users/waseem/Behat/ - line 20, column 0)     

    【讨论】:

      【解决方案3】:

      查看 behat\autoload_map.php。当找不到该文件时,该文件将替代 Symfony 自动加载器。它包含一个将命名空间\类映射到目录和文件的数组。只需添加一些内容,您就可以让这个版本的 Behat 正常工作。

      如果确实如其他人所说的那样,Behat 不再支持 PEAR 通道,那么您可以自行使用此解决方案。就个人而言,我将研究另一种方法来使我的 Behat 安装保持最新状态。

      【讨论】:

        猜你喜欢
        • 2010-12-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-10-12
        • 2011-08-16
        • 1970-01-01
        相关资源
        最近更新 更多