|
@@ -24,13 +24,18 @@ class TestBonus extends PHPUnit_Framework_TestCase
|
|
|
Base::run_util();
|
|
|
}
|
|
|
|
|
|
+ public static function tearDownAfterClass()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
public function testSend()
|
|
|
{
|
|
|
$param = bonus\parameters::test_bonus();
|
|
|
- $ret = bonus_helper::make_bonus($param,$param['rate_money']);
|
|
|
- if($ret != false) {
|
|
|
+ $ret = bonus_helper::make_bonus($param, $param['rate_money']);
|
|
|
+ if ($ret != false) {
|
|
|
$type_sn = $ret['type_sn'];
|
|
|
- $bonus = bonus_helper::send($type_sn,[39659]);
|
|
|
+ $bonus = bonus_helper::send($type_sn, [39659]);
|
|
|
|
|
|
return $type_sn;
|
|
|
} else {
|
|
@@ -42,19 +47,20 @@ class TestBonus extends PHPUnit_Framework_TestCase
|
|
|
{
|
|
|
//$scaler = new \bonus\scaler([10 => 10,100 => 100,50 => 50, 30 => 30]);
|
|
|
//$scaler = new \bonus\scaler([10 => 10,50 => 50, 20 => 60,100 => 100]);
|
|
|
- $scaler = new \bonus\scaler([30 => 0.62,100 => 1.26]);
|
|
|
+ $scaler = new \bonus\scaler([30 => 0.62, 100 => 1.26]);
|
|
|
$ret = $scaler->calc();
|
|
|
}
|
|
|
+
|
|
|
public function testModel()
|
|
|
{
|
|
|
- $item = Model('user_bonus')->field('*')->where(array('type_id' => 105,'bonus_id' => 2491))->select();
|
|
|
- bonus_helper::shake($item[0]['type_id'],$item[0]['bonus_id'],$item[0]['bonus_value'],3,bonus_helper::direct_dec());
|
|
|
+ $item = Model('user_bonus')->field('*')->where(array('type_id' => 105, 'bonus_id' => 2491))->select();
|
|
|
+ bonus_helper::shake($item[0]['type_id'], $item[0]['bonus_id'], $item[0]['bonus_value'], 3, bonus_helper::direct_dec());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function testMemBonus()
|
|
|
{
|
|
|
$x = false;
|
|
|
- if($x) {
|
|
|
+ if ($x) {
|
|
|
$user_bonus = 0;
|
|
|
}
|
|
|
$bonus_val = $user_bonus->bonus_value();
|
|
@@ -67,11 +73,13 @@ class TestBonus extends PHPUnit_Framework_TestCase
|
|
|
{
|
|
|
notify_helper::bonus_expired();
|
|
|
}
|
|
|
+
|
|
|
public function testPush()
|
|
|
{
|
|
|
$url = 'http://a.lrlz.com/mobile/index.php?act=rank_list&op=index&client_type=wap&list_sn=%3Cddc6ff0cd400941d3ae0f8b0889d54a1%3E&from=timeline&isappinstalled=0';
|
|
|
$url = urldecode($url);
|
|
|
}
|
|
|
+
|
|
|
public function testTime()
|
|
|
{
|
|
|
$send_date = new DateTime();
|
|
@@ -85,7 +93,7 @@ class TestBonus extends PHPUnit_Framework_TestCase
|
|
|
{
|
|
|
$x = RESOURCE_SITE_URL;
|
|
|
|
|
|
- $data = array(10 => 3018.25,90 => 5623,30 => 5566);
|
|
|
+ $data = array(10 => 3018.25, 90 => 5623, 30 => 5566);
|
|
|
|
|
|
ksort($data);
|
|
|
$xdata = $data;
|
|
@@ -105,9 +113,8 @@ class TestBonus extends PHPUnit_Framework_TestCase
|
|
|
|
|
|
$params = explode('#', urldecode($src));
|
|
|
$result = [];
|
|
|
- foreach ($params as $val)
|
|
|
- {
|
|
|
- if(preg_match_all('/^(\d{1,2})\|(\d{1,4})\|(\d{1,6})$/', $val, $match)) {
|
|
|
+ foreach ($params as $val) {
|
|
|
+ if (preg_match_all('/^(\d{1,2})\|(\d{1,4})\|(\d{1,6})$/', $val, $match)) {
|
|
|
$item['rate'] = intval($match[1]);
|
|
|
$item['amount'] = intval($match[2]);
|
|
|
$item['num'] = intval($match[3]);
|
|
@@ -120,8 +127,9 @@ class TestBonus extends PHPUnit_Framework_TestCase
|
|
|
// $regxp = '/(([0-9]*){3}[#]?/i';
|
|
|
$regxp = '/(([0-9]*)|([0-9]*)|([0-9]*)[^#]){1}[#]?/i';
|
|
|
|
|
|
- $val = preg_match_all($regxp,$src,$match);
|
|
|
+ $val = preg_match_all($regxp, $src, $match);
|
|
|
}
|
|
|
+
|
|
|
public function testMicro()
|
|
|
{
|
|
|
microtime();
|
|
@@ -129,7 +137,7 @@ class TestBonus extends PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testRefundBonus()
|
|
|
{
|
|
|
- account_helper::bonus_refund('700532450973112490',36490);
|
|
|
+ account_helper::bonus_refund('700532450973112490', 36490);
|
|
|
}
|
|
|
|
|
|
public function testBonusShare()
|
|
@@ -141,9 +149,9 @@ class TestBonus extends PHPUnit_Framework_TestCase
|
|
|
|
|
|
private function make_sn()
|
|
|
{
|
|
|
- return mt_rand(10,99)
|
|
|
- . sprintf('%010d',time())
|
|
|
- . sprintf('%06d', (float) microtime() * 1000000);
|
|
|
+ return mt_rand(10, 99)
|
|
|
+ . sprintf('%010d', time())
|
|
|
+ . sprintf('%06d', (float)microtime() * 1000000);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -158,6 +166,7 @@ class TestBonus extends PHPUnit_Framework_TestCase
|
|
|
$sns = array_unique($sns);
|
|
|
$count = count($sns);
|
|
|
}
|
|
|
+
|
|
|
public function testMoney()
|
|
|
{
|
|
|
|
|
@@ -165,9 +174,9 @@ class TestBonus extends PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testStaff()
|
|
|
{
|
|
|
- $staffs = lrlz_staff();
|
|
|
+ $staffs = lrlz_staff();
|
|
|
$type_sn = '36221506503801666595';
|
|
|
- bonus_helper::send_mobile($type_sn,$staffs);
|
|
|
+ bonus_helper::send_mobile($type_sn, $staffs);
|
|
|
}
|
|
|
|
|
|
public function testAndroidUrl()
|
|
@@ -176,8 +185,8 @@ class TestBonus extends PHPUnit_Framework_TestCase
|
|
|
echo $url;
|
|
|
}
|
|
|
|
|
|
- public static function tearDownAfterClass()
|
|
|
+ public function testLowestprice()
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|