1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?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/policy/match/ImateTester.php');
- //require_once(BASE_HELPER_PATH . '/refill/policy/match/mixed_match.php');
- //require_once(BASE_HELPER_PATH . '/refill/policy/match/whole_match.php');
- //require_once(BASE_HELPER_PATH . '/refill/policy/match/type_match.php');
- //require_once(BASE_HELPER_PATH . '/refill/policy/match/type_spec_match.php');
- require_once(BASE_HELPER_PATH . '/refill/XYZRefillFactory.php');
- class TestMixedMatch extends TestCase
- {
- public static function setUpBeforeClass(): void
- {
- Base::run_util();
- }
- public function testImate()
- {
- $imate = new refill\ImateTester();
- $imate->load();
- // $content = "{\"gross\": {\"10131\": [157690, 54, 157636, 0.34, 24.19, 0.005973]}, \"detail\": {\"10131-5-30\": [143, 5, 138, 0.03497, 1.44, 0.0096], \"10131-6-100\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-5-100\": [13, 2, 11, 0.15385, 1.0, 0.005], \"10131-6-50\": [0, 0, 0, 0.0, 0.0, 0.0], \"10131-4-50\": [52224, 20, 52204, 0.00038, 9.25, 0.00925], \"10131-4-100\": [105233, 27, 105206, 0.00026, 12.5, 0.00463], \"10131-5-50\": [6, 0, 6, 0.0, 0.0, 0.0], \"10131-4-30\": [6, 0, 6, 0.0, 0.0, 0.0]}, \"types\": {\"10131-5\": [162, 7, 155, 0.04321, 2.44, 0.006971], \"10131-6\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-4\": [157463, 47, 157416, 0.000298, 21.75, 0.005878]}}";
- $content = "{\"gross\": {\"10131\": [157690, 54, 157636, 0.21, 24.19, 0.005973]}, \"detail\": {\"10131-5-30\": [143, 5, 138, 0.03497, 1.44, 0.0096], \"10131-6-100\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-5-100\": [13, 2, 11, 0.15385, 1.0, 0.005], \"10131-6-50\": [0, 0, 0, 0.0, 0.0, 0.0], \"10131-4-50\": [52224, 20, 52204, 0.00038, 9.25, 0.00925], \"10131-4-100\": [105233, 27, 105206, 0.00026, 12.5, 0.00463], \"10131-5-50\": [6, 0, 6, 0.0, 0.0, 0.0], \"10131-4-30\": [6, 0, 6, 0.0, 0.0, 0.0]}, \"types\": {\"10131-5\": [162, 7, 155, 0.21321, 2.44, 0.006971], \"10131-6\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-4\": [157463, 47, 157416, 0.208, 21.75, 0.005878]}}";
- $counts = json_decode($content,true);
- $gross = $counts['gross'];
- $detail = $counts['detail'];
- $types = $counts['types'];
- $imate->update($gross, $detail, $types);
- [$match,$can_last] = $imate->ratio_match(10131, 14, 5, 30, [1, 2]);
- Log::record("match={$match},can_last={$can_last}",Log::DEBUG);
- }
- public function testFactory()
- {
- $content = "{\"gross\": {\"10131\": [157690, 54, 157636, 0.21, 24.19, 0.005973]}, \"detail\": {\"10131-5-30\": [143, 5, 138, 0.03497, 1.44, 0.0096], \"10131-6-100\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-5-100\": [13, 2, 11, 0.15385, 1.0, 0.005], \"10131-6-50\": [0, 0, 0, 0.0, 0.0, 0.0], \"10131-4-50\": [52224, 20, 52204, 0.00038, 9.25, 0.00925], \"10131-4-100\": [105233, 27, 105206, 0.00026, 12.5, 0.00463], \"10131-5-50\": [6, 0, 6, 0.0, 0.0, 0.0], \"10131-4-30\": [6, 0, 6, 0.0, 0.0, 0.0]}, \"types\": {\"10131-5\": [162, 7, 155, 0.21321, 2.44, 0.006971], \"10131-6\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-4\": [157463, 47, 157416, 0.208, 21.75, 0.005878]}}";
- $counts = json_decode($content,true);
- $gross = $counts['gross'];
- $detail = $counts['detail'];
- $types = $counts['types'];
- refill\RefillFactory::instance()->UpdateMchRatios($gross,$detail,$types);
- }
- }
|