PHP code example of melvdouc / obrussa
1. Go to this page and download the library: Download melvdouc/obrussa 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/ */
melvdouc / obrussa example snippets
// tests/index.php
sa\TestSuite;
function add(int $a, int $b): int
{
return $a + $b;
}
TestSuite::test("1 + 1 = 2", function (TestSuite $testSuite) {
$testSuite->assertEquals(add(1, 1), 2);
});
TestSuite::test("instanceof", function (TestSuite $testSuite) {
$testSuite->expect($testSuite)->toBeInstanceOf(TestSuite::class);
$testSuite->expect($testSuite)->not()->toBeInstanceOf(\stdClass::class);
});
TestSuite::test("email", function (TestSuite $testSuite) {
$testSuite->assertEmail("[email protected]");
$testSuite->assertNotEmail("example@mail");
$testSuite->expect("example.com")->not()->toBeEmail();
});
TestSuite::run();
bash
php tests/index.php