1. Go to this page and download the library: Download ksamborski/php-integration 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/ */
ksamborski / php-integration example snippets
use PHPIntegration\TestParameter;
use PHPIntegration\Test;
use PHPIntegration\TestGroup;
use PHPIntegration\Console;
$groups = [
new TestGroup(
"Basic tests",
[
new Test(
"Test1",
"Simple test 1",
function ($p) {
usleep(rand(10000, 100000));
return true;
}
),
new Test(
"Test2",
"Failing test",
function ($p) {
return "this is a test that always fails";
}
)
]
)
];
new Test(
"Test2",
"Failing test",
function($p) {
usleep(20000);
return "this is a test that always fails";
},
10
)
use PHPIntegration\Testable;
use PHPIntegration\Utils\RandomHelper;
use PHPIntegration\Randomizable;
class TestObject implements Randomizable, Testable
{
public $name;
public function __construct(string $name)
{
$this->name = $name;
}
public static function build(string $value) : Testable
{
return new TestObject($value);
}
public static function validate(string $value, bool $valid = true)
{
$fstLetter = substr($value, 0, 1);
if ($valid === true) {
if (strtolower($fstLetter) == $fstLetter) {
return "Value must start from upper case.\n";
} else {
return true;
}
} else {
if (strtolower($fstLetter) == $fstLetter) {
return true;
} else {
return "Value must not start from upper case.\n";
}
}
}
public function asStringParameter() : string
{
return $this->name;
}
public static function randomValid()
{
return new TestObject(strtoupper(RandomHelper::randomString()));
}
public static function randomInvalid()
{
return new TestObject(strtolower(RandomHelper::randomString()));
}
}
bash
composer install ksamborski/php-integration
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.