PHP code example of spyryto / test-harness

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

    

spyryto / test-harness example snippets




describe ("expectEquals");

it ("works with simple values", function () {
	expect (1 + 1, is (2));
});

runAll(__DIR__ . '/../..');

runAll(__DIR__);

testing ...\test1.test.php

Passed tests  : 1/1
json
"tasks":
	...
	[
		{
			"label": "tests",
			"type": "shell",
			"command": "php test-harness/src/tests.php",
			"group": {
				"kind": "test",
				"isDefault": true
			}
		},
	]
	...
json
"tasks":
	...
	[
		{
			"label": "tests",
			"type": "shell",
			"command": "php test-harness/src/tests.php prepend=src/vendor/autoload.php",
			"group": {
				"kind": "test",
				"isDefault": true
			}
		},
	]
	...
bash
php test.php