为什么 magento behat 测试找不到我的数据库


Why can magento behat test not find my database?

当我调用bin/behat来执行我的测试时,我收到此错误:

test.dev bin/behat
  [Zend_Db_Adapter_Exception]                       
  SQLSTATE[HY000] [2002] No such file or directory  
  [PDOException]                                    
  SQLSTATE[HY000] [2002] No such file or directory

这是我composer.json

{
  "require": {
    "php": ">=5.4.0"
  },
  "require-dev": {
    "magetest/magento-behat-extension": "dev-develop",
    "magetest/magento-phpspec-extension": "~2.0",
    "peridot-php/webdriver-manager": "dev-master",
    "bossa/phpspec2-expect": "dev-master",
    "behat/mink-extension": "*",
    "behat/mink-goutte-driver": "*",
    "behat/mink-selenium2-driver": "*",
    "behat/mink-selenium-driver": "*"
  },
  "autoload": {
    "psr-0": {
      "": [
        "html/app",
        "html/app/code/community",
        "html/app/code/core",
        "html/lib"
      ],
      "Mage" : "html/app/code/core"
    }
  },
  "config": {
    "bin-dir": "bin"
  }
}

这是我的behat.yml

default:
  paths:
    features:  features
    bootstrap: features/bootstrap
  extensions:
    MageTest'MagentoExtension'Extension: ~
    Behat'MinkExtension'Extension:
      base_url: http://test.dev
      goutte: ~
      selenium2: ~
      default_session: selenium2

这是几个教程的拼凑而成,而每个教程都抛出了相同的错误。我的Magento安装是在项目下的html中。与所有教程唯一不同的是,我没有html/app/code/local文件夹。作曲家安装和 behat --init 运行没有错误。

编辑:我正在使用 MAMP Pro,所以我发现了这个问题。但是将套接字文件链接到/tmp 并没有解决我的问题。

由于我使用 MAMP,因此我还必须为 CLI 配置它:

export PATH=/Applications/MAMP/bin/php/php5.6.10/bin:$PATH

现在 CLI 使用我的 MAMP PHP 版本,一切运行良好。