user_helperTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. }