2017 © Pedro PelĂĄez
 

behat-extension behat-mailcatcher-extension

MailCatcher extension for Behat

image

kibao/behat-mailcatcher-extension

MailCatcher extension for Behat

  • Friday, May 9, 2014
  • by kibao
  • Repository
  • 2 Watchers
  • 9 Stars
  • 25,377 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 1 Versions
  • 8 % Grown

The README.md

MailCatcher Extension

Build Status Scrutinizer Code Quality, (*1)

MailCatcher is a super simple SMTP server which catches any message sent to it., (*2)

MailCatcherExtension provides:, (*3)

  • Kibao\Behat\MailCatcherExtension\Context\MailCatcherAwareContext, which provides MailCatcher Client instance for your context.
  • MailCatcherContext context which provides base step definitions for your contexts.

Installation

This extension requires:, (*4)

  • Behat 3.0+

Through Composer

  1. Add MailCatcherExtension to your composer.json:, (*5)

    {
        "require-dev": {
            ...
            "kibao/mailcatcher": "*@dev",
            "kibao/behat-mailcatcher-extension": "0.2.*@dev"
        }
    }
    
  2. Install or update vendors:, (*6)

    $ composer update kibao/mailcatcher kibao/behat-mailcatcher-extension
    
  3. Activate extension in your behat.yml:, (*7)

    default:
       # ...
       extensions:
            Kibao\Behat\MailCatcherExtension\Extension: ~
    

Configuration

Default configuration:, (*8)

default:
    # ...
    extensions:
        Kibao\Behat\MailCatcherExtension\Extension:
            client:
                url:    http://localhost    # MailCatcher http url
                port:   1080                # MailCatcher http port
            purge_before_scenario:      true
            mailcatcher_client:         kibao.mailcatcher.client.default    # client service
            mailcatcher_connection:     kibao.mailcatcher.connection.guzzle # connection service

Usage

First of all you need to have installed MailCatcher., (*9)

There are few options:, (*10)

  1. Extending RawMailCatcherContext in your feature suite. It provides you preconfigured MailCatcher with basic methods. RawMailCatcherContext doesn't provide any step definitions, so you can extend it in many contexts., (*11)

  2. Extending MailCatcherContext with one of your contexts. It provides you same things as RawMailCatcherContext and also predefined steps out of the box., (*12)

  3. Adding MailCatcherContext as context in your suite., (*13)

    default:
      suites:
        my_suite:
          contexts:
            - FeatureContext
            - Kibao\Behat\MailCatcherExtension\Context\MailCatcherContext
    
  4. Implementing MailCatcherAwareContext with your context. Target context must implement setMailCatcher(ClientInterface $mailcatcher). This method would be automatically called immediately after each context creation before each scenario. $mailcatcher will be preconfigured client based on your settings., (*14)

The Versions

09/05 2014

dev-master

9999999-dev

MailCatcher extension for Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

by PrzemysƂaw Piechota

mail email extension behat mailcatcher