Skip to content

Commit a4eefbc

Browse files
committed
增加测试用授权方法
1 parent 04be314 commit a4eefbc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/Testing/UserAuthMockery.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of KnowYourself.
6+
*
7+
* @link https://www.zhiwotansuo.cn
8+
* @document https://github.com/kydever/work-wx-user/blob/main/README.md
9+
* @contact l@hyperf.io
10+
* @license https://github.com/kydever/work-wx-user/blob/main/LICENSE
11+
*/
12+
namespace KY\WorkWxUser\Testing;
13+
14+
use KY\WorkWxUser\UserAuth;
15+
16+
class UserAuthMockery
17+
{
18+
public static function mockToken(int $id): string
19+
{
20+
$userAuth = new UserAuth($id, $id . '_unit');
21+
$userAuth->save();
22+
23+
return $userAuth->getToken();
24+
}
25+
}

0 commit comments

Comments
 (0)