add_balance('system', 0, 0, strtotime('2021-12-01'),'order_time'); } //docker-compose run -d phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillBalance::testInitBalance)( .*)?$/" --test-suffix TestRefillBalance.php /var/www/html/test public function testInitBalance() { $refill_balance = new statistics\refill_balance(); $refill_balance->stat_all(0, strtotime('2022-01-15')); } public function testSomething() { $checker = function ($cfg) { if(!empty($cfg['segment'])) { $segment = $cfg['segment']; $sitems = explode(',',$segment); $tmp = []; foreach ($sitems as $sitem) { $sitem = trim($sitem); if(!empty($sitem)) { $tmp[] = $sitem; } } if(!empty($tmp)) { $cfg['segment'] = implode('|',$tmp); } } return $cfg; }; $cfg['segment'] = '133,139,147,,'; $acfg = $checker($cfg); $reg = "/^(?:{$acfg['segment']})\d*$/"; // $x = preg_match('/^(?:139)\d{8}$/', 13911129866, $matches); $x = preg_match($reg, 13911129866, $matches); } }