PHPackages                             jasny/codeception-module - 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. jasny/codeception-module

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

jasny/codeception-module
========================

Codeception Module for Jasny MVC

v1.3.0(6y ago)07.8k↓50%MITPHPPHP &gt;=7.2.0

Since Dec 19Pushed 6y agoCompare

[ Source](https://github.com/jasny/codeception-module)[ Packagist](https://packagist.org/packages/jasny/codeception-module)[ RSS](/packages/jasny-codeception-module/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (13)Versions (15)Used By (0)

Codeception Jasny MVC Module
============================

[](#codeception-jasny-mvc-module)

[![Build Status](https://camo.githubusercontent.com/10922af7ec521ced7bac0a0986b47b11c216a244f9be179f37ea3e566809240e/68747470733a2f2f7472617669732d63692e6f72672f6a61736e792f636f646563657074696f6e2d6d6f64756c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jasny/codeception-module)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a1f145e6d039801c09378f7285f08116830eb78e4f223a505d33079af41277b8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a61736e792f636f646563657074696f6e2d6d6f64756c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jasny/codeception-module/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/3ece079073e006780aa56fd7f59dcfcfb069b17f6933a5962e5d0ed7a01a7f5d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a61736e792f636f646563657074696f6e2d6d6f64756c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jasny/codeception-module/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/c7576b4db7130dded0e47f40a14b0a60c4093cfc424331c1d283b3835ef9b789/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39353665336164302d666633302d346432362d616366392d3262386561323462643166302f6d696e692e706e67)](https://insight.sensiolabs.com/projects/956e3ad0-ff30-4d26-acf9-2b8ea24bd1f0)[![Packagist Stable Version](https://camo.githubusercontent.com/f7eec6f7cc9e19c8e3ffb6217d53d9258a8b201897e1b163f1de990ffdf1f2f8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a61736e792f636f646563657074696f6e2d6d6f64756c652e737667)](https://packagist.org/packages/jasny/codeception-module)[![Packagist License](https://camo.githubusercontent.com/80b4c98a684bcd00d411357cd2d50037b71a04e7f1c111209a57532778929a6e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a61736e792f636f646563657074696f6e2d6d6f64756c652e737667)](https://packagist.org/packages/jasny/codeception-module)

This module allows you to run tests using [Jasny MVC](http://www.github.com/jasny/mvc/).

Install
-------

[](#install)

Via commandline:

```
composer require --dev jasny/codeception-module
```

Via `composer.json`:

```
{
  "require-dev": {
    "jasny/codeception-module": "^1.0"
  }
}
```

Config
------

[](#config)

- container: Path to file that returns a [`Interop\Container\ContainerInterface`](https://github.com/container-interop/container-interop).

```
class_name: FunctionalTester
modules:
    enabled:
        - \Helper\Functional
        - \Jasny\Codeception\Module:
            container: tests/_data/container.php
        - REST:
            depends: \Jasny\Codeception\Module
```

### Container

[](#container)

The container an object that takes care or depency injection. It must be an object the implements [`Interop\Container\ContainerInterface`](https://github.com/container-interop/container-interop). If you're project doesn't use an dependency injection container, you can use [Picotainer](https://github.com/thecodingmachine/picotainer), which is automatically installed with this codeception module.

The container must contain an item for `Jasny\RouterInterface`.

Example of `container.php` using Picotainer.

```
use Mouf\Picotainer\Picotainer;
use Jasny\Router;
use Jasny\Router\Routes\Glob as Routes;
use Jasny\RouterInterface;

return new Picotainer([
    RouterInterface::class => function() {
        return new Router(new Routes([
            '/' => ['controller' => 'foo'],
            // ...
        ]));
    }
]);
```

The cointain may have a `Psr\Http\Message\ServerRequestInterface` and `Psr\Http\Message\ResponseInterface` item.

```
use Mouf\Picotainer\Picotainer;
use Jasny\Router;
use Jasny\Router\Routes\Glob as Routes;
use Jasny\RouterInterface;
use Jasny\HttpMessage\ServerRequest;
use Jasny\HttpMessage\Response;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;

return new new Picotainer([
    RouterInterface::class => function() {
        return new Router(new Routes([
            '/' => ['controller' => 'foo'],
            // ...
        ]));
    },
    ServerRequestInterface::class => function() {
        return new ServerRequest();
    },
    ResponseInterface::class => function() {
        return new Response();
    }
]);
```

### Legacy code

[](#legacy-code)

The Jasny PSR-7 http message implementation is capable of dealing with legacy code by [binding to the global environment](https://github.com/jasny/http-message#testing-legacy-code).

This allows testing of code that accesses superglobals like `$_GET` and `$_POST` and outputs using `echo` and `headers()`.

Use `withGlobalEnvironment(true)` for both request and response object. The Codeception module will make sure output buffering starts and everything is restored after each test.

```
use Mouf\Picotainer\Picotainer;
use Jasny\Router;
use Jasny\Router\Routes\Glob as Routes;
use Jasny\RouterInterface;
use Jasny\HttpMessage\ServerRequest;
use Jasny\HttpMessage\Response;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;

return new Picotainer([
    RouterInterface::class => function() {
        return new Router(new Routes([
            '/' => ['controller' => 'foo'],
            // ...
        ]));
    },
    ServerRequestInterface::class => function() {
        return (new ServerRequest())->withGlobalEnvironment(true);
    },
    ResponseInterface::class => function() {
        return (new Response())->withGlobalEnvironment(true);
    }
]);
```

Error handler
-------------

[](#error-handler)

The container may also contain a [Jasny Error Handler](https://github.com/jasny/error-handler). If a fatal error is caught by the error handler, the output is typically a nice message intended for the end user. It doesn't contain any information about the error itself.

If the container has a `Jasny\ErrorHandlerInterface` object, it will output the error as debug information on a failed test. To see the error use the `--debug` flag when running `composer run`.

```
use Mouf\Picotainer\Picotainer;
use Jasny\Router;
use Jasny\Router\Routes\Glob as Routes;
use Jasny\RouterInterface;
use Jasny\ErrorHandler;
use Jasny\ErrorHandlerInterface;

return new Picotainer([
    RouterInterface::class => function($container) {
        $router = new Router(new Routes([
            '/' => ['controller' => 'foo'],
            // ...
        ]));

        $errorHandler = $container->get(ErrorHandlerInterface::class);
        $router->add($errorHandler->asMiddleware());

        return $router;
    },
    ErrorHandlerInterface::class => function() {
        $errorHandler = new ErrorHandler();

        $errorHandler->logUncaught(E_PARSE | E_ERROR | E_WARNING | E_USER_WARNING);
        $errorHandler->logUncaught(Exception::class);
        $errorHandler->logUncaught(Error::class); // PHP7 only

        return $errorHandler;
    });
]);
```

API
---

[](#api)

- container - The container
- client - [BrowserKit](http://symfony.com/doc/current/components/browser_kit.html) client

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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 ~139 days

Recently: every ~269 days

Total

9

Last Release

2321d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.6.0

v1.2.0PHP &gt;=7.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3379a93d51305df325df9045e1a8b205d195e4e8c01312dff53a000ee79002eb?d=identicon)[jasny](/maintainers/jasny)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/jasny-codeception-module/health.svg)

```
[![Health](https://phpackages.com/badges/jasny-codeception-module/health.svg)](https://phpackages.com/packages/jasny-codeception-module)
```

###  Alternatives

[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[codeception/module-symfony

Codeception module for Symfony framework

949.4M95](/packages/codeception-module-symfony)[typo3/testing-framework

The TYPO3 testing framework provides base classes for unit, functional and acceptance testing.

675.0M775](/packages/typo3-testing-framework)[docler-labs/codeception-slim-module

Codeception Module for Slim framework.

13178.0k1](/packages/docler-labs-codeception-slim-module)[acquia/orca

A tool for testing a company's software packages together in the context of a realistic, functioning, best practices Drupal build

32902.4k](/packages/acquia-orca)

PHPackages © 2026

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