2017 © Pedro Peláez
 

package tests

A PHP package for tests

image

phplegends/tests

A PHP package for tests

  • Friday, January 5, 2018
  • by brcontainer
  • Repository
  • 2 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

PHPLegends\Test\Bench

travis-ci, (*1)

Usage:, (*2)

<?php
use PHPLegends\Tests\Bench;
use PHPLegends\Tests\BenchObject;

require 'vendor/autoload.php'; //Composer autoload

//Function for test
function foo($a, $b) {
    $a + $b;
}

$bench = new Bench;

$bench->defaultCicles(500);//Set default cicles for all tests

//Added callback function with string
$test1 = $bench->addTest(function ($a, $b) {
    $baz = 'foo';
    $baz($a, $b);
});

//Setup cicles (loops) and arguments for callback
$test1->cicles(15000)->args(1, 2);

//Added test callback function with call_user_func_array
$test2 = $bench->addTest(function($a, $b) {
    $baz = 'foo';
    call_user_func_array($baz, array($a, $b));
});
$test2->cicles(15000)->args(3, 2);

//Call "direct" function foo
$test3 = $bench->addTest(function() {
    foo(10, 10);
});

$bench->run();

echo 'Test #1 (memory):', $test1->memory(), '<br>';
echo 'Test #1 (time):',   $test1->time(), '


'; echo 'Test #2 (memory):', $test2->memory(), '<br>'; echo 'Test #2 (time):', $test2->time(), '
'; echo 'Test #3 (memory):', $test3->memory(), '<br>'; echo 'Test #3 (time):', $test3->time(), '<br>'; $bench = $test1 = $test2 = $test3 = null;

The Versions

05/01 2018

dev-master

9999999-dev

A PHP package for tests

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Guilherme Nascimento
by Wallace de Souza Vizerra

16/05 2016

dev-experimental

dev-experimental

A PHP package for tests

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Guilherme Nascimento