1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 2017/7/14
- * Time: 下午4:22
- */
- define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/fooder.php');
- require_once(BASE_ROOT_PATH . '/helper/search/tcp_client.php');
- require_once(BASE_ROOT_PATH . '/helper/message/publisher.php');
- class TestFriends extends PHPUnit_Framework_TestCase
- {
- public static function setUpBeforeClass()
- {
- Base::run_util();
- }
- public function testAddFollow()
- {
- $result = search\relation_client::instance()->add_follow(array('user_id' => 36490,'friends'=>[1,2,3,4,5]));
- $result = search\relation_client::instance()->add_follow(array('user_id' => 36490,'friends'=>[3,4,5,6,7]));
- }
- public function testDelFollow()
- {
- $result = search\relation_client::instance()->del_follow(array('user_id' => 36490,'friends'=>[1]));
- $result = search\relation_client::instance()->del_follow(array('user_id' => 36490,'friends'=>[3,4]));
- }
- public function testFetchFollow()
- {
- for ($i =0 ; $i < 10000; ++$i) {
- $result = search\relation_client::instance()->fetch_follow(array('user_id' => 36490));
- }
- }
- public function testAddSpecial()
- {
- $result = search\relation_client::instance()->add_special(array('user_id' => 36490,'specials'=>array(['type' => 0,'spid' => 7])));
- $result = search\relation_client::instance()->add_special(array('user_id' => 36490,'specials'=>array(['type' => 0,'spid' => 6])));
- $result = search\relation_client::instance()->add_special(array('user_id' => 36490,'specials'=>array(['type' => 0,'spid' => 9])));
- $result = search\relation_client::instance()->add_special(array('user_id' => 36490,'specials'=>array(['type' => 0,'spid' => 17])));
- $result = search\relation_client::instance()->add_special(array('user_id' => 36490,'specials'=>array(['type' => 0,'spid' => 16])));
- $result = search\relation_client::instance()->add_special(array('user_id' => 36490,'specials'=>array(['type' => 0,'spid' => 19])));
- }
- public function testDelSpecial()
- {
- $result = search\relation_client::instance()->add_special(array('user_id' => 36490,'specials'=>array(['type' => 0,'spid' => 9])));
- $result = search\relation_client::instance()->del_special(array('user_id' => 36490,'specials'=>array(['type' => 0,'spid' => 9])));
- }
- public function testFetchPub()
- {
- $result = search\relation_client::instance()->fetch_pub_special(['special_id' => -1,'count'=> 1000,'type' => 1]);
- for ($i =0 ; $i < 10000; ++$i)
- {
- $result = search\relation_client::instance()->fetch_pub_special(['special_id' => 11,'count'=> 10,'type' => 1]);
- $result = search\relation_client::instance()->fetch_pub_special(['special_id' => 11,'count'=> 10,'type' => 0]);
- $result = search\relation_client::instance()->fetch_pub_special(['special_id' => 9,'count'=> 10,'type' => 0]);
- $result = search\relation_client::instance()->fetch_pub_special(['special_id' => 9,'count'=> 10,'type' => 1]);
- }
- }
- //publisher
- public function testAddFriend()
- {
- $publisher = new message\publisher();
- $publisher->add_fellow(36490,[1,2,3,57]);
- }
- public function testDelFriend()
- {
- $publisher = new message\publisher();
- $publisher->del_fellow(36490,[1,2,3,57]);
- }
- public function testAddSpecials()
- {
- $publisher = new message\publisher();
- $publisher->add_special(36490,array(['type' => 1, 'spid' =>1],['type' => 1,'spid' => 2],['type' => 1,'spid' => 3]));
- }
- public function testDelSpecials()
- {
- $publisher = new message\publisher();
- $publisher->del_special(36490,array(['type' => 1, 'spid' =>1],['type' => 1,'spid' => 2],['type' => 1,'spid' => 3]));
- }
- public function testFetchSelfSpecials()
- {
- $result = search\relation_client::instance()->fetch_self_special(['user_id' => 39621,
- 'special_id' => -1,'count'=> 20,'type' => 1]);
- }
- }
|