<?php

use PhpBeast\AuthorTestAggregator;
use PhpBeast\PrettyTestInterpreter;
use Tiphaine\TiphaineTool;
require_once "bigbang.php";
//------------------------------------------------------------------------------/
// EXHAUSTING TEST DEMO
//------------------------------------------------------------------------------/
$agg = AuthorTestAggregator::create();
$a = ['', '/path/to/file.txt', 'empty', 'false', 'true', 'null', '6.4', '6'];
$b = ['', '/path/to/file.txt', 'empty', false, true, null, (double) 6.4, (int) 6];
$agg->addTestsByColumn($a, $b, function ($value, $expected, &$msg) {
    $res = TiphaineTool::autoCast($value);
    return $expected === $res;
});
PrettyTestInterpreter::create()->execute($agg);
Example #2
0
 public static function autoCast($string)
 {
     return TiphaineTool::autoCast($string);
 }