2017 © Pedro Peláez
 

library behat3-zendframework3-extension

Behat Zend Framework 3 Integration Extension

image

vircom/behat3-zendframework3-extension

Behat Zend Framework 3 Integration Extension

  • Monday, April 17, 2017
  • by VirCom
  • Repository
  • 1 Watchers
  • 0 Stars
  • 37 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 76 % Grown

The README.md

# Behat 3 Zend Framework 3 Extension

Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads License, (*1)

This package provides a base implementation to test applications developed with Zend Framework 3 library. It able to pass to your Behat context files services, declares in your application., (*2)

Installation

composer require vircom/behat3-zendframework3-extension

Usage

Create behat.yml file

Within your project root, create behat.yml file with content below or add this code to your existing file on the root level:, (*3)

default:
    extensions:
        VirCom\Behat3ZendFramework3Extension:
            configuration_path: /config/application.config.php

Parameters: * configuration_path - path to main Zend Framework 3 configuration file. Default to: /config/application.config.php., (*4)

Create your feature context file

Just run command:, (*5)

vendor/bin/behat --init 

Now, Behat generate for your fist context file:, (*6)

features/bootstrap/FeatureContext.php

Change its content to:, (*7)

<?php

use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;

use Zend\EventManager\EventManagerInterface;

/**
 * Defines application features from the specific context.
 */
class FeatureContext implements Context
{
    /**
     * Initializes context.
     *
     * Every scenario gets its own context instance.
     * You can also pass arbitrary arguments to the
     * context constructor through behat.yml.
     */
    public function __construct(EventManagerInterface $eventManager)
    {
        echo get_class($eventManager);
    }
}

Create example feature file

Put text below to file, (*8)

features/example.feature
Feature: Product basket
  In order to buy products
  As a customer
  I need to be able to put interesting products into a basket
Configure service injection within behat.yml file

Configure your context:, (*9)

default:
   suites:
        default:
            contexts:
                - FeatureContext:
                    eventManager: '@EventManager'
    extensions:
        VirCom\Behat3ZendFramework3Extension:
            configuration_path: /config/application.config.php

Each defined context argument, if starts with @ character, will be resolved to matching service instance. Otherwise, will return raw parameter as string., (*10)

For example it could be registered any custom service:, (*11)

My\Application\Namespace\ExampleService

The Versions

17/04 2017

dev-master

9999999-dev

Behat Zend Framework 3 Integration Extension

  Sources   Download

MIT

The Requires

 

The Development Requires

framework extension zend behat zf3

17/04 2017

1.0.0

1.0.0.0

Behat Zend Framework 3 Integration Extension

  Sources   Download

MIT

The Requires

 

The Development Requires

framework extension zend behat zf3