PHPackages                             vierge-noire/cakephp-behat-suite - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. vierge-noire/cakephp-behat-suite

ActiveLibrary[Testing &amp; Quality](/categories/testing)

vierge-noire/cakephp-behat-suite
================================

Test suite for behavior driven tests.

v0.2.0(5y ago)81033MITPHP

Since Oct 16Pushed 4y ago2 watchersCompare

[ Source](https://github.com/vierge-noire/cakephp-behat-suite)[ Packagist](https://packagist.org/packages/vierge-noire/cakephp-behat-suite)[ RSS](/packages/vierge-noire-cakephp-behat-suite/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (7)Versions (4)Used By (0)

cakephp-behat-suite
===================

[](#cakephp-behat-suite)

A CakePHP dedicated suite for behavior driven development.

Installation
------------

[](#installation)

For CakePHP ^4.0:

```
composer require --dev vierge-noire/cakephp-behat-suite "^0.2"

```

For CakePHP ^3.8:

```
composer require --dev vierge-noire/cakephp-behat-suite "^0.1"

```

Setup
-----

[](#setup)

Copy this file in the main directory of your app, under the name `behat.yml:

```
#behat.yml
default:
  autoload:
    '': '%paths.base%/tests/Behat'
  suites:
    app:
      paths:
        - '%paths.base%/tests/Behat/features'
      contexts:
        - CakephpBehatSuite\Context\BootstrapContext:
            bootstrap: '%paths.base%/tests/bootstrap.php'
        - Context\AppContext

```

The `behat.yml` file is the equivalent to the PHPUnit's `phpunit.xml` file. `%paths.base%` points to your main directory.

Once your `behat.yml` file has been created, run `vendor/bin/behat --init` to automatically create the folders and Context classes as defined in the config file.

You can define more suites additional to app, for example for your plugins.

IMPORTANT: the `CakephpBehatSuite\Context\BootstrapContext` should be present in each of your suites. The argument `bootstrap:` should direct to the `bootstrap.php` file of your tests.

For each suite, you will have to specify the location of your features under the key `path`.

The package provides a set of steps defined by `CakephpBehatSuite\Context\BootstrapContext`.

Run your tests
--------------

[](#run-your-tests)

The command `vendor/bin/behat` will run your tests as defined in the `behat.yml file.

Fixture factories
-----------------

[](#fixture-factories)

The package makes uses of the CakePHP fixture factories plugin. Make sure your factories are baked and working, in order to use the present package.

You will find the package and its documentation [here](https://github.com/vierge-noire/cakephp-fixture-factories).

The BootstrapContext class
--------------------------

[](#the-bootstrapcontext-class)

The `CakephpBehatSuite\Context\BootstrapContext` contains a set of steps, documented below.

The Context will ensure that the test database gets emptied before each scenario.

Example
-------

[](#example)

### Feature

[](#feature)

This is how an integration on the edit action of your UsersController could be:

```
Feature: Users edit

  Background:
    Given I create 1 user with id 1
    And I am a user with a UsersGroups.Permissions name Users
    And I log in

  Scenario:
    When I get 'users/edit/1'
    Then the response is OK

# Edit a non existent user
  Scenario:
    When I get 'users/edit/2'
    Then the response triggers an error

# Edit an existing user
  Scenario:
    When I post 'users/edit/1' with data:
      | username  | email          |
      | foo       | foo@foo.foo    |
    Then I am redirected to 'users'
    And this user exists:
      | id  | username  | email          |
      | 1   | foo       | foo@foo.foo    |

```

### behat.yml with plugin

[](#behatyml-with-plugin)

This behat file includes a suite for a dummy plugin MyCustomPlugin. For each suite, a Context has been added too.

```
#behat.yml
default:
  autoload:
    '': '%paths.base%/tests/Behat'
  suites:
    app:
      paths:
        - '%paths.base%/tests/Behat/features'
      contexts:
        - CakephpBehatSuite\Context\BootstrapContext:
            bootstrap: '%paths.base%/tests/bootstrap.php'
        - Context\AppContext
    my-custom-plugin:
      paths:
        - '%paths.base%/plugins/MyCustomPlugin/tests/Behat/features'
      contexts:
        - CakephpBehatSuite\Context\BootstrapContext:
            bootstrap: '%paths.base%/tests/bootstrap.php'
        - Context\TestPluginContext

```

Use Migrations
--------------

[](#use-migrations)

Take full advantage of the [Phinx migrations](https://book.cakephp.org/migrations/3/en/index.html) in order to maintain the schema of your test DB. This is optional, but **highly recommended**.

The [CakePHP Test Migrator package](https://github.com/vierge-noire/cakephp-test-migrator) will assist you in doing this very simply.

License
-------

[](#license)

The CakePHPFixtureFactories plugin is offered under an [MIT license](https://opensource.org/licenses/mit-license.php).

Copyright 2020 Juan Pablo Ramirez and Nicolas Masson

Licensed under The MIT License Redistributions of files must retain the above copyright notice.

Authors
-------

[](#authors)

- Juan Pablo Ramirez
- Nicolas Masson

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2077d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23249541?v=4)[jpramirez](/maintainers/pabloelcolombiano)[@pabloelcolombiano](https://github.com/pabloelcolombiano)

---

Top Contributors

[![pabloelcolombiano](https://avatars.githubusercontent.com/u/23249541?v=4)](https://github.com/pabloelcolombiano "pabloelcolombiano (4 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/vierge-noire-cakephp-behat-suite/health.svg)

```
[![Health](https://phpackages.com/badges/vierge-noire-cakephp-behat-suite/health.svg)](https://phpackages.com/packages/vierge-noire-cakephp-behat-suite)
```

###  Alternatives

[drupal/drupal-extension

Drupal extension for Behat

21215.5M166](/packages/drupal-drupal-extension)[friends-of-behat/symfony-extension

Integrates Behat with Symfony.

48024.5M632](/packages/friends-of-behat-symfony-extension)[friends-of-behat/variadic-extension

Variadic support for behat context arguments

2276.3M487](/packages/friends-of-behat-variadic-extension)[wp-cli/wp-cli-tests

WP-CLI testing framework

423.0M129](/packages/wp-cli-wp-cli-tests)[friends-of-behat/mink-extension

Mink extension for Behat

14035.9M553](/packages/friends-of-behat-mink-extension)[imbo/behat-api-extension

API extension for Behat

1092.6M9](/packages/imbo-behat-api-extension)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
