-
-
Notifications
You must be signed in to change notification settings - Fork 1
UnitTest
Using Unit Test is pretty simple, all you need is just add a PHP file inside /tests folder.

In this folder you can add as many file as you want for testing.
But you shouldn't declare any function/class/variable outside of function scope if you don't want any conflict with other test file.
Every test file will be tested after calling this command line.
$ scarlets testThe test file must be a PHP file and it can contain more than one test case.
Before you're doing any test it's better to describe it first what it going to be tested.
$describe("Your tests file description or title");And after that you can create new scope of function as a sandbox of your code.
$it("Testing something", function($assert){
$result = 3 * 2;
// Make sure it return 6
$assert::equal($result, 6);
});If there are no error and incorrect result, it would return Success on the CLI.
But on different case, below will return Failed and the execution will be returned.
$it("Testing something", function($assert){
$result = 3 + 2;
// Make sure it return 6
$assert::equal($result, 6);
// The execution won't reach here
// ...
});This documentation still haven't finished yet because some feature still being developed.