PHP code example of osflab / test

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

    

osflab / test example snippets


use Osf\Test\Runner as OsfTest;

class Test extends OsfTest
{
    public static function run()
    {
        self::reset();

        // Your test here
        try {
            self::assert(/* condition */, /* [message if fails] */);
            self::assertEqual(/* calculated */, /* expected */, /* [message if fails] */);
            // ...
        }

        // Displays an exception
        catch (\Exception $e) {
            self::assertFalseException($e);
        }

        return self::getResult();
    }
}