function testQuote($str, $exp) { global $agg; $agg->addTest(function (&$msg, $testNumber) use($str, $exp) { $res = BabyDashTool::parse($str, true); $ret = $res === $exp; if (false === $ret) { ComparisonErrorTableTool::collect($testNumber, $exp, $res); } return $ret; }); }
<?php use Bat\ValidationTool; use PhpBeast\AuthorTestAggregator; use PhpBeast\PrettyTestInterpreter; use PhpBeast\Tool\ComparisonErrorTableTool; require_once "bigbang.php"; $agg = AuthorTestAggregator::create(); $a = ['*****@*****.**', 'cromagnon.fr', 'cromagnon@fr', '-@-.-']; $b = [true, false, false, false]; $agg->addTestsByColumn($a, $b, function ($value, $expected, &$msg, $testNumber) { $res = ValidationTool::isEmail($value); if ($expected !== $res) { ComparisonErrorTableTool::collect($testNumber, $expected, $res); } return $expected === $res; }); PrettyTestInterpreter::create()->execute($agg); ComparisonErrorTableTool::display();