123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 16/6/27
- * Time: 下午10:27
- */
- define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/fooder.php');
- require_once(BASE_ROOT_PATH . '/helper/bonus_helper.php');
- require_once(BASE_ROOT_PATH . '/helper/account_helper.php');
- require_once(BASE_ROOT_PATH . '/helper/category_helper.php');
- require_once(BASE_ROOT_PATH . '/helper/brand_helper.php');
- class bar
- {
- public function __construct()
- {
- echo __FUNCTION__ . " \n";
- }
- public function __destruct()
- {
- echo __FUNCTION__ . " \n";
- }
- }
- class account_helperTest extends PHPUnit_Framework_TestCase
- {
- public static function setUpBeforeClass()
- {
- Base::run_util();
- }
- public function testPayRefund()
- {
- //account_helper::pay_refund(36490,500,'退款红包');
- }
- public function testModelCond()
- {
- $cur_time = time();
- $cond['usable_time'] = array(array('gt',$cur_time), array('elt',$cur_time + 200),'and');
- $cond['notify_time'] = array(array('eq',0), array('elt',$cur_time + 300),'or');
- $mod_bonus = Model('user_bonus');
- $X= $mod_bonus->field('bonus_id,usable_time as usabletm')->where($cond)->select();
- }
- public function testCondition()
- {
- $mod_type = Model('bonus_type');
- // $condition = array('sender_id' => 36490, 'relayer_id' => 36490, '_op' => 'or');
- // $condition = array($condition,array('make_type' => 0),'_op' => 'and');
- //$condition = "(sender_id=36490 or relayer_id => 36490) and (make_type = 0)";
- $member_id = 36490;
- $cond = array();
- $cond['sender_id|repayer_id'] = array('_multi'=>true,$member_id,36491);
- $cond['make_type'] = 0;
- $mod_type->where($cond)->select();
- }
- private function xxx()
- {
- $bar = new bar();
- }
- public function testDestruct()
- {
- echo __FUNCTION__ . " begin \n";
- $this->xxx();
- $bar = new bar();
- echo __FUNCTION__ . " end \n";
- }
- public function testBrands()
- {
- $url = '美宝莲-心机咬唇0727.mp4';
- $url = urlencode($url);
- $x = mt_rand(1,1);
- $brands = brand_helper::instance()->brandex();
- }
- public function testPaysuccess()
- {
- account_helper::paysuccess_bonus(38682,1000);
- $mod = Model('order');
- $info = $mod->getOrderInfo(array('pay_sn' => '740532913609644490'));
- $buyer_id = intval($info['buyer_id']);
- $goods_amount = intval($info['goods_amount']);
- }
- public function testEvalu()
- {
- $data = [];
- $item['goods_id'] = 10;
- $item['score'] = 3;
- $item['comment'] = 'hello world';
- $item['images'][] = '/Users/stanley-king/work/PHPProject/shopnc/data/upload/uploadtmp/20161215080916-593ef137-923f-14c0-1307-118be24c9c0e.jpg';
- $data['goods'] = $item;
- $x = json_encode($data);
- $x = base64_encode($x);
- $y = json_decode($x,true);
- }
- public function testUpfile()
- {
- $file = '/Users/stanley-king/work/PHPProject/shopnc/data/upload/uploadtmp/20161215081131-53be4be9-fe01-50e7-28c0-ded900c9a0f6.jpg';
- $ext = exif_imagetype($file);
- $exif = image_type_to_mime_type($ext);
- $tagnmae = exif_tagname($ext);
- $info = new SplFileInfo($file);
- $type = $info->getType();
- $type = $info->getExtension();
- $size = $info->getSize();
- $tmp_name = $info->getFilename();
- }
- public function testTmpfile()
- {
- $file = '/private/var/tmp/php49DATg';
- $info = file($file);
- }
- public function testEvaluation()
- {
- $mod = Model();
- $field = 'member.member_avatar,goods.goods_spec,evaluate_goods.geval_id,evaluate_goods.geval_commonid,evaluate_goods.geval_goodsid,evaluate_goods.geval_goodsname,evaluate_goods.geval_scores,evaluate_goods.geval_content,evaluate_goods.geval_isanonymous,evaluate_goods.geval_addtime,evaluate_goods.geval_frommemberid,evaluate_goods.geval_frommembername,evaluate_goods.geval_explain,evaluate_goods.geval_image';
- $on = 'evaluate_goods.geval_frommemberid=member.member_id,goods.goods_id=evaluate_goods.geval_goodsid';
- $mod->table('evaluate_goods,member,goods')->field($field);
- $items = $mod->join('inner,left')->on($on)->where(array('evaluate_goods.geval_commonid' => 2188))->select();
- foreach ($items as $item)
- {
- $keyval = unserialize($item['goods_spec']);
- foreach ($keyval as $key => $val) {
- $goods_spec = $val;
- }
- }
- //spec =
- $x = 0;
- }
- public static function tearDownAfterClass()
- {
- }
- }
|