PHP code example of maplephp / unitary

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

    

maplephp / unitary example snippets


$unit->case("MaplePHP Request URI path test", function() {
    $response = new Response(200);

    $this->add($response->getStatusCode(), function() {
        return $this->equal(200);
    }, "Did not return HTTP status code 200");
});



$unit = new MaplePHP\Unitary\Unit();

// If you build your library correctly, it will become very easy to mock, as I have below.
$request = new MaplePHP\Http\Request(
    "GET",
    "https://admin:[email protected]:65535/test.php?id=5221&greeting=hello",
);

// Begin by adding a test case
$unit->case("MaplePHP Request URI path test", function() use($request) {

    // Then add tests to your case:
    // Test 1: Access the validation instance inside the add closure
    $this->add($request->getMethod(), function($value) {
        return $this->equal("GET");

    }, "HTTP Request method type does not equal GET");
    // Adding an error message is not al("admin") && $this->withValue($arr[1])->equal("mypass"));
        }

    ], "Did not get the expected user info credentials");
});

$unit->manual('maplePHPRequest')->case("MaplePHP Request URI path test", function() {
    ...
});
bash
php vendor/bin/unitary
bash
php vendor/bin/unitary --show=b0620ca8ef6ea7598eaed56a530b1983
bash
php vendor/bin/unitary --show=maplePHPRequest
bash
php vendor/bin/unitary --path="/tests/"
bash
php vendor/bin/unitary --exclude="./tests/unitary-query-php, tests/otherTests/*, */extras/*"