12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- use PHPUnit\Framework\TestCase;
- define('APP_ID', 'balance');
- define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/global.php');
- require_once(BASE_CORE_PATH . '/lrlz.php');
- require_once(BASE_ROOT_PATH . '/fooder.php');
- require_once(BASE_HELPER_PATH . '/statistics/refill_balance.php');
- class TestRefillBalance extends TestCase
- {
- public static function setUpBeforeClass(): void
- {
- Base::run_util();
- }
- public function testAddBalance()
- {
- $refill_balance = new statistics\refill_balance();
- $refill_balance->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);
- }
- }
|