1. Go to this page and download the library: Download xp-forge/assert 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/ */
xp-forge / assert example snippets
use unittest\assert\{Assert, All};
class ExampleTest {
#[@test]
public function succeeds() {
Assert::that(['The Dude'])->hasSize(1)->contains('The Dude');
}
#[@test]
public function fails() {
All::of(function() {
Assert::that('localhost')->startsWith('www');
Assert::that('example.com')->endsWith('.org');
});
}
}
$tim= new Person(6100, 'Tim Tailor');
Assert::that($tim)->extracting('name')->isEqualTo('Tim Tailor');