user_helperTest.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 16/6/25
  6. * Time: 下午4:00
  7. */
  8. define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
  9. //require_once(BASE_ROOT_PATH . '/fooder.php');
  10. //require_once(BASE_ROOT_PATH . '/helper/relation_helper.php');
  11. //require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
  12. class user_helperTest extends PHPUnit_Framework_TestCase
  13. {
  14. public static function setUpBeforeClass()
  15. {
  16. Base::run_util();
  17. }
  18. public function testUpContacts()
  19. {
  20. // $datas = array('13911129867','13911129868','13911129869','13911129870','13911129870');
  21. // $jsData = json_encode($datas);
  22. // $jsData = urlencode($jsData);
  23. // session_helper::parse_contacts($jsData);
  24. }
  25. public function testSocket()
  26. {
  27. $socket = stream_socket_client ("tcp://192.168.1.105:2000");
  28. $data = array('type' => 1,'keyword' => "美白");
  29. $data = serialize($data);
  30. $i = 0;
  31. while ($i < 10000) {
  32. $len = sprintf("%010d",strlen($data));
  33. stream_socket_sendto($socket,$len . $data);
  34. $i++;
  35. }
  36. stream_socket_shutdown($socket,STREAM_SHUT_RDWR);
  37. }
  38. public function testLen()
  39. {
  40. $x = sprintf("%010d",500);
  41. $y = intval($x);
  42. $read = "";
  43. while ($read) {
  44. echo "erad";
  45. }
  46. }
  47. public function testImage()
  48. {
  49. $ret = getimagesize("http://192.168.0.200/data/upload/mobile/special/s0/s0_05300358745765788.png",$imginfo);
  50. }
  51. public function testActivity()
  52. {
  53. //require_once ('/Users/stanley-king/work/PHPProject/shopnc/mobile/control/activity.php');
  54. $x = 'http://a.lrlz.com/mobile/index.php?act=activity&amp;op=limit_entra';
  55. $y = htmlspecialchars_decode($x);
  56. $x = 'http://a.lrlz.com/mobile/index.php?act=activity&op=limit_entra';
  57. $y = htmlspecialchars($x);
  58. }
  59. public function testKeysort()
  60. {
  61. $data = array(10 => 3018.25,90 => 5623,30 => 5566);
  62. ksort($data);
  63. $xdata = $data;
  64. krsort($xdata);
  65. }
  66. }