PHP code example of mileschou / slim-test

1. Go to this page and download the library: Download mileschou/slim-test 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/ */

    

mileschou / slim-test example snippets


use MilesChou\Slim\Test\SlimCase;

class SlimAppTest extends PHPUnit_Framework_TestCase
{
    public function setUp()
    {
        $app = 

public function testSeeResponseOk()
{
    // Arrange
    $url = '/will/return/ok';

    // Act
    $this->slimCase->sendGET($url);

    // Assert
    $this->slimCase->seeResponseOk();
}

$this->slimCase->client->get($url);

use MilesChou\Slim\Test\SlimCaseTrait;

class SlimAppTest extends PHPUnit_Framework_TestCase
{
    use SlimCaseTrait;

    public function setUp()
    {
        $app =     // Arrange
        $url = '/will/return/ok';

        // Act
        $this->sendGET($url);

        // Assert
        $this->seeResponseOk();
    }
}

// features/bootstrap/FeatureContext.php
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use MilesChou\Slim\Test\SlimCaseTrait;

class FeatureContext implements Context, SnippetAcceptingContext
{
    use SlimCaseTrait;

    public function __construct()
    {
        // bootstrap your slim app
        $app =  $this->seeResponseOk();
    }
}