2017 © Pedro PelĂĄez
 

behat-extension zf-test-case-behat-extension

Integration testing for ZF MVC applications in Behat by exposing Zend\Test classes (originally built for PHPUnit)

image

noiselabs/zf-test-case-behat-extension

Integration testing for ZF MVC applications in Behat by exposing Zend\Test classes (originally built for PHPUnit)

  • Tuesday, September 19, 2017
  • by noiselabs
  • Repository
  • 2 Watchers
  • 2 Stars
  • 3,083 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 20 % Grown

The README.md

ZF Test Case Behat Extension

Build Status Scrutinizer Code Quality, (*1)

Integration testing for ZF MVC applications in Behat by exposing Zend\Test classes (originally built for PHPUnit)., (*2)

Installation

This extension requires:, (*3)

  • Behat 3.0+

The recommended installation method is through Composer:, (*4)

$ composer require --dev noiselabs/zf-test-case-behat-extension

You can then activate the extension in your behat.yml:, (*5)

default:
    # ...
    extensions:
        Noiselabs\Behat\ZfTestCaseExtension\ServiceContainer\ZfTestCaseExtension:
            configuration: </path/to/application.config.php>

Usage

Implement ZfTestCaseAwareContext or extend ZfTestCaseContext:, (*6)

<?php

use Album\Controller\AlbumController;
use Noiselabs\Behat\ZfTestCaseExtension\Context\ZfTestCaseAwareContext;
use Noiselabs\Behat\ZfTestCaseExtension\TestCase\HttpControllerTestCase;

class MyContext implements ZfTestCaseAwareContext
{
    /**
     * @var HttpControllerTestCase
     */
    private $testCase;

    public function setTestCase(HttpControllerTestCase $testCase)
    {
        $this->testCase = $testCase;
    }

    /**
     * @When /^the album endpoint is called$/
     */
    public function testIndexActionCanBeAccessed()
    {
        // See https://docs.zendframework.com/tutorials/unit-testing/
        $this->testCase->dispatch('/album');
        $this->testCase->assertResponseStatusCode(200);
        $this->testCase->assertModuleName('Album');
        $this->testCase->assertControllerName(AlbumController::class);
        $this->testCase->assertControllerClass('AlbumController');
        $this->testCase->assertMatchedRouteName('album');
    }
}

Copyright (c) 2017 VĂ­tor BrandĂŁo. Licensed under the MIT License., (*7)

The Versions

18/09 2017

0.1.1

0.1.1.0

Integration testing for ZF MVC applications in Behat by exposing Zend\Test classes (originally built for PHPUnit)

  Sources   Download

MIT

The Requires

 

The Development Requires

18/09 2017

0.1.0

0.1.0.0

Integration testing for ZF MVC applications in Behat by exposing Zend\Test classes (originally built for PHPUnit)

  Sources   Download

MIT

The Requires