duanhuo0577 2011-06-02 14:49
浏览 51

与貂皮相媲美

Does anyone know how to successfully configure Mink to work with Behat? In case if anyone doesn't know, Behat is a BDD(Behaviour-Driven Development) framework for PHP and Mink provides a browser emulators abstraction layer to test with.

You can find out more about Behat at http://behat.org/ and Mink at https://github.com/Behat/Mink or http://www.knplabs.com/fr/blog/one-mink-to-rule-them-all

Basically i followed the instructions at http://www.knplabs.com/fr/blog/one-mink-to-rule-them-all to configure my Mink to work with my Behat. My behat.yml, the one located inside the Behat folder, not the Mink folder, is as follows:

default:
  paths:
    features:               %%BEHAT_CONFIG_PATH%%/features
    formatter:
    name:                   progress
pretty:
  formatter:
    name:                   pretty
    parameters:
      multiline_arguments:  false
default:
    environment:
        parameters:
            start_url: http://localhost/
imports:
    - mink/behat.yml

I also have the following code in my features/support/boostrap.php

require_once 'mink/autoload.php';

However, having the following code in my features/support/env.php

$world->client = new \Goutte\Client;

would give me a PHP Fatal error: Class 'Goutte\Client' not found in terminal(OSX) when i use the behat command. This happens even if i have the goutte.phar inside my behat/Mink/Vendor/Goutte folder.

Hope anyone can enlighten me on where i went wrong and if there was any part in the question where I wasn't being clear about it, do let me know. Thanks a lot.

  • 写回答

1条回答 默认 最新

  • doupinyan0186 2011-06-02 15:54
    关注

    Here it is: https://github.com/knplabs/mink-demo ;-)

    Basically, with Mink, you don't need to create or require Goutte client it's done by Mink automatically. Your $world was also enhanced and now you're able to get mink session inside step definitions:

    $downloadsLink = $world->getSession()->getPage()->findLink('downloads');
    

    Also, you've forgot to include PHPUnit!

    See mink-demo for getting great example ;-)

    评论

报告相同问题?

悬赏问题

  • ¥15 vue3+element-plus页面崩溃
  • ¥15 像这种代码要怎么跑起来?
  • ¥15 怎么改成循环输入删除(语言-c语言)
  • ¥15 安卓C读取/dev/fastpipe屏幕像素数据
  • ¥15 pyqt5tools安装失败
  • ¥15 mmdetection
  • ¥15 nginx代理报502的错误
  • ¥100 当AWR1843发送完设置的固定帧后,如何使其再发送第一次的帧
  • ¥15 图示五个参数的模型校正是用什么方法做出来的。如何建立其他模型
  • ¥100 描述一下元器件的基本功能,pcba板的基本原理