1. Go to this page and download the library: Download luttje/php-example-tester 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/ */
luttje / php-example-tester example snippets
use Luttje\ExampleTester\Tests\TestCase;
final class ExampleClassTest extends TestCase
{
public static function exampleMethod(): void
{
// This is an example method.
$a = 1;
$b = 25;
$c = $a + $b;
echo $c;
// This is the end of the example method.
}
/**
* @test
*/
public function testExampleMethod(): void
{
ob_start();
self::exampleMethod();
$output = ob_get_clean();
$this->assertSame('26', $output);
}
}
> // This is an example method.
> $a = 1;
> $b = 25;
>
> $c = $a + $b;
>
> echo $c;
> // This is the end of the example method.
>
> public static function exampleMethod(): void
> {
> // This is an example method.
> $a = 1;
> $b = 25;
>
> $c = $a + $b;
>
> echo $c;
> // This is the end of the example method.
> }
>
> use Luttje\ExampleTester\Tests\TestCase;
>
> final class ExampleClassTest extends TestCase
> {
> public static function exampleMethod(): void
> {
> // This is an example method.
> $a = 1;
> $b = 25;
>
> $c = $a + $b;
>
> echo $c;
> // This is the end of the example method.
> }
>
> /**
> * @test
> */
> public function testExampleMethod(): void
> {
> ob_start();
> self::exampleMethod();
> $output = ob_get_clean();
>
> $this->assertSame('26', $output);
> }
> }
>
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.