PHP code example of docler-labs / codeception-slim-module
1. Go to this page and download the library: Download docler-labs/codeception-slim-module library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
docler-labs / codeception-slim-module example snippets
use Slim\Factory\AppFactory;
$app = AppFactory::create();
// Add routes and middlewares here.
return $app;
class UserCest
{
public function getUserReturnsWithEmail(FunctionalTester $I): void
{
$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendGET('/users/John');
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson(
[
'email' => '[email protected]',
]
);
}
}
class UserCest
{
// Content-Type and Accept headers are already set via module config
public function getUserReturnsWithEmail(FunctionalTester $I): void
{
$I->sendGET('/users/John');
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson(
[
'email' => '[email protected]',
]
);
}
public function createUserReturnsCreated(FunctionalTester $I): void
{
$I->sendPOST('/users', ['name' => 'Jane', 'email' => '[email protected]']);
$I->seeResponseCodeIs(201);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.