コード例 #1
0
ファイル: TagTest.php プロジェクト: wailovet/wechat-qy
 public function testAll()
 {
     $corpid = 'wxf6a65243b40d13ac';
     $corpsecret = 'G_4BogDOqC-nyEmAbpCf9mRx6ZC9O176gYUZGJdau_ZTkftQlTE4NW9zwayiAORJ';
     $tag = new Tag($corpid, $corpsecret);
     $user = new User($corpid, $corpsecret);
     $name = time() . rand(100, 999);
     $data = $tag->name($name)->create();
     $tagid = $data['tagid'];
     $data = $tag->lists();
     $b = false;
     for ($i = 0; $i < count($data['taglist']); $i++) {
         if ($data['taglist'][$i]['tagid'] == $tagid && $data['taglist'][$i]['tagname'] == $name) {
             $b = true;
         }
     }
     $this->assertTrue($b);
     $name = time() . rand(100, 999);
     $tag->id($tagid)->update(array("name" => $name));
     $data = $tag->lists();
     $b = false;
     for ($i = 0; $i < count($data['taglist']); $i++) {
         if ($data['taglist'][$i]['tagid'] == $tagid && $data['taglist'][$i]['tagname'] == $name) {
             $b = true;
         }
     }
     $this->assertTrue($b);
     $wxid = "testss_sss" . rand(100, 999);
     $user->weixinid($wxid)->userid($name)->name($name)->create();
     $tag->id($tagid)->user($name)->add();
     $data = $tag->id($tagid)->get();
     $b = false;
     for ($i = 0; $i < count($data['userlist']); $i++) {
         if ($data['userlist'][$i]['userid'] == $name && $data['userlist'][$i]['name'] == $name) {
             $b = true;
         }
     }
     $this->assertTrue($b);
     $tag->id($tagid)->user($name)->delete();
     $tag->id($tagid)->delete();
 }
コード例 #2
0
ファイル: UserTest.php プロジェクト: wailovet/wechat-qy
 public function testAll()
 {
     $corpid = 'wxf6a65243b40d13ac';
     $corpsecret = 'G_4BogDOqC-nyEmAbpCf9mRx6ZC9O176gYUZGJdau_ZTkftQlTE4NW9zwayiAORJ';
     $user = new User($corpid, $corpsecret);
     $senddata = array("userid" => time() . rand(100, 999), "name" => time() . rand(100, 999), "weixinid" => "testss_sss" . rand(100, 999), "mobile" => time() . rand(100, 999), "position" => time() . rand(100, 999), "email" => time() . rand(100, 999) . "@qq.com");
     $user->userid($senddata["userid"])->name($senddata["name"])->weixinid($senddata["weixinid"])->mobile($senddata["mobile"])->position($senddata["position"])->email($senddata["email"])->sex(User::SEX_MALE)->create();
     $updatedata = array("name" => time() . rand(100, 999), "mobile" => time() . rand(100, 999), "weixinid" => "testss_sss" . rand(100, 999), "position" => time() . rand(100, 999), "email" => time() . rand(100, 999) . "@qq.com");
     $data = $user->userid($senddata["userid"])->get();
     foreach ($senddata as $key => $val) {
         $this->assertTrue($data[$key] == $val);
     }
     $user->userid($senddata["userid"])->name($updatedata["name"])->weixinid($updatedata["weixinid"])->mobile($updatedata["mobile"])->position($updatedata["position"])->email($updatedata["email"])->update();
     $data = $user->userid($senddata["userid"])->get();
     foreach ($updatedata as $key => $val) {
         $this->assertTrue($data[$key] == $val);
     }
     $user->userid($senddata["userid"])->delete();
     $user->simpleList();
     $user->fetchChild()->follow()->simpleList();
     $user->fetchChild()->notFollow()->detailedList();
     $user->fetchChild()->notFollow()->disabled()->detailedList();
     try {
         $user->userid($senddata["userid"])->get();
     } catch (Exception $e) {
         $this->assertTrue(true);
         return;
     }
     $this->assertTrue(false);
 }