12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- use PHPUnit\Framework\TestCase;
- define('APP_ID', 'test');
- 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 . '/refill/util.php');
- require_once(BASE_HELPER_PATH . '/refill/event/card_crash.php');
- class TestRefillUtil extends TestCase
- {
- public static function setUpBeforeClass(): void
- {
- Base::run_util();
- }
- public function testQueueOrder()
- {
- refill\util::push_queue_order(1092,'abcdefg',30);
- $val = refill\util::query_queue_order(1092,'abcdefg');
- }
- public function testWriteCard()
- {
- refill\util::write_card('1000113300017553895',mtopcard\SinopecCard,'13911129867');
- }
- public function testChannelSubmitLimit()
- {
- $ch_name = 'test';
- $fail_times = 10;
- $enough_times = 30;
- refill\util::write_ch_submit_times($ch_name,$fail_times,$enough_times);
- $val = refill\util::read_ch_submit_times($ch_name);
- $all = refill\util::read_ches_submit_times();
- }
- public function testMonitor()
- {
- $card_no = 13911129867;
- $card_no1 = 13911129868;
- $monitor = new refill\event\card_crash();
- $ret = $monitor->can_commit($card_no,'beirui_nation');
- $monitor->notify($card_no,'beirui_nation',true);
- $ret = $monitor->can_commit($card_no1,'beirui_nation');
- $monitor->commit($card_no1,'beirui_nation');
- $monitor->notify($card_no,'beirui_nation',false);
- }
- }
|