1. Go to this page and download the library: Download elazar/phantestic 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/ */
elazar / phantestic example snippets
$classmap_path = '../vendor/composer/autoload_classmap.php';
$loader = new \Phantestic\Loader\ClassmapFileObjectLoader($classmap_path);
$handlers = [ new \Phantestic\Handler\CliOutputHandler ];
$runner = new \Phantestic\Runner\LocalRunner($loader, $handlers);
$runner->run();
// src/Adder.php
class Adder
{
public function add($x, $y)
{
return $x + $y;
}
}
// tests/AdderTest.php
class AdderTest
{
public function testAdd()
{
$adder = new Adder;
$result = $adder->add(2, 2);
if ($result != 4) {
throw new \RangeException('2 + 2 should equal 4');
}
}
}
public function setEventEmitter(EventEmitterInterface $emitter)
{
$emitter->on('phantestic.test.failresult', [$this, 'handleFail']);
$emitter->on('phantestic.test.passresult', [$this, 'handlePass']);
$emitter->on('phantestic.tests.before', [$this, 'beforeTests']);
$emitter->on('phantestic.tests.after', [$this, 'afterTests']);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.