PHP code example of parf / spartan-test

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

    

parf / spartan-test example snippets


#!/usr/bin/env stest

; $prices = [12, 18, 30];

array_sum($prices);
    60;

; $user = loadUser(42);     // setup: starts with ";" in column one

$user->displayName();       // expression under test
    'Ada Lovelace';         // expected result: four-space indentation

$responseBody;
    ~ "account created";
    ~ /request-id:\s+\w+/i;

calculateTax(100, 0.2);
    20;

; \STest::domain('https://example.test');

/account;
    ~ "Welcome";