PHP code example of sinevia / php-library-testify
1. Go to this page and download the library: Download sinevia/php-library-testify 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/ */
sinevia / php-library-testify example snippets
use Math\MyCalc;
use Testify\Testify;
$tf = new Testify("MyCalc Test Suite");
$tf->beforeEach(function($tf) {
$tf->data->calc = new MyCalc(10);
});
$tf->test("Testing the add() method", function($tf) {
$calc = $tf->data->calc;
$calc->add(4);
$tf->assert($calc->result() == 14);
$calc->add(-6);
$tf->assertEquals($calc->result(), 8);
});
$tf->test("Testing the mul() method", function($tf) {
$calc = $tf->data->calc;
$calc->mul(1.5);
$tf->assertEquals($calc->result(), 12);
$calc->mul(-1);
$tf->assertEquals($calc->result(), -12);
});
$tf();
composer