1
0
mirror of https://github.com/danog/math.git synced 2024-11-30 04:19:31 +01:00
math/phpunit.php
Benjamin Morel 49ea5a085e Reworked Travis build matrix
Travis now supports merged code coverage reports, so we do not need to merge them ourselves.
2015-05-22 13:39:59 +02:00

43 lines
1.0 KiB
PHP

<?php
use Brick\Math\Internal\Calculator;
require 'vendor/autoload.php';
/**
* @return Calculator
*/
function getCalculatorImplementation()
{
switch ($calculator = getenv('CALCULATOR')) {
case 'GMP':
$calculator = new Calculator\GmpCalculator();
break;
case 'BCMath':
$calculator = new Calculator\BcMathCalculator();
break;
case 'Native':
$calculator = new Calculator\NativeCalculator();
break;
default:
if ($calculator === false) {
echo 'CALCULATOR environment variable not set!' . PHP_EOL;
} else {
echo 'Unknown calculator: ' . $calculator . PHP_EOL;
}
echo 'Example usage: CALCULATOR={calculator} vendor/bin/phpunit' . PHP_EOL;
echo 'Available calculators: GMP, BCMath, Native' . PHP_EOL;
exit(1);
}
echo 'Using ', get_class($calculator), PHP_EOL;
return $calculator;
}
Calculator::set(getCalculatorImplementation());