No description
  • PHP 98.1%
  • HTML 1.9%
Find a file
2017-03-05 03:30:56 +07:00
src Use PSR's ContainerInterface. 2017-03-05 02:58:23 +07:00
tests Ignore generated test classes. 2017-03-05 02:59:05 +07:00
.gitignore Ignore override file(s) of docker-compose.yml. 2016-10-13 19:03:35 +07:00
.gitmodules Add Naktibalda/codeception-rest-testcase.git as gitmodules. 2016-10-07 10:33:56 +07:00
.travis.yml Add php 7.1. 2016-10-07 16:56:48 +07:00
codeception.yml Move modules definition to functional.suite.yml. 2016-10-07 12:45:59 +07:00
composer.json Moves to dev section. 2017-03-05 02:57:27 +07:00
docker-compose.yml No need to use own Dockerfile for Codeception. 2017-03-05 02:45:33 +07:00
LICENSE Update license year. 2017-03-05 02:57:01 +07:00
README.md Show badge for master, not exact version. 2017-03-05 03:22:55 +07:00

Codeception Slim Module

Master Build Status Packagist Stable Version Packagist License Libraries.io for GitHub

This module allows you to run tests inside Slim 3 Microframework.
Based on ZendExpressive Module.

Install

Via commandline:

composer require --dev herloct/codeception-slim-module

Via composer.json:

{
  "require-dev": {
    "herloct/codeception-slim-module": "^1.1"
  }
}

Config

Put this on your codeception.yml

modules:
  config:
    \Herloct\Codeception\Module\Slim:
      container: path/to/container.php
    REST:
      depends: \Herloct\Codeception\Module\Slim

Or on your tests/functional.suite.yml

modules:
  enabled:
    - \Helper\Functional
    - \Herloct\Codeception\Module\Slim:
        container: path/to/container.php
    - REST:
        depends: \Herloct\Codeception\Module\Slim

The container properties is a relative path to file which returns your App's Container.
Here is the minimum container.php contents.

require __DIR__.'/vendor/autoload.php';

use Psr\Container\ContainerInterface;
use Slim\App;
use Slim\Container;

$container = new Container([
    App::class => function (ContainerInterface $c) {
        $app = new App($c);

        // routes and middlewares here

        return $app;
    }
]);

return $container;

You could use this Sample Project as a reference.

API

  • app - instance of \Slim\App
  • container - instance of \Psr\Container\ContainerInterface
  • client - BrowserKit client

Todos

  • Add more acceptance/functional tests other than REST.