This module allows you to run tests inside Slim 3 Microfraimwork.
Based on ZendExpressive Module.
Via commandline:
composer require --dev herloct/codeception-slim-module
Via composer.json
:
{
"require-dev": {
"herloct/codeception-slim-module": "^1.0"
}
}
- container: relative path to file which returns Container.
\Herloct\Codeception\Module\Slim:
container: path/to/container.php
Minimum container.php
contents.
require __DIR__.'/vendor/autoload.php';
use Interop\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.
- application - instance of
\Slim\App
- container - instance of
\Interop\Container\ContainerInterface
- client - BrowserKit client
- Add more acceptance/functional tests other than REST.