Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改-获取手机号逻辑 #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Translator/UserTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public function translate(array $info, ?User $user = null): User
}
$user->name = $info['name'];
$user->position = $info['position'];
$user->mobile = $info['mobile'] ?? '';
$user->mobile = $info['extattr']['attrs'][0]['value'] ?? '';
$user->email = $info['biz_mail'] ?? $info['email'] ?? '';
$user->avatar = $info['thumb_avatar'] ?? $info['avatar'] ?? '';
$user->avatar = '';
$user->status = $info['status'];
$user->enable = $info['enable'];
$user->alias = $info['alias'];
Expand Down
3 changes: 1 addition & 2 deletions tests/Cases/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace HyperfTest\Cases;

use Hyperf\Contract\ConfigInterface;
use Mockery;
use PHPUnit\Framework\TestCase;

use function KY\WorkWxUser\di;
Expand All @@ -24,7 +23,7 @@ abstract class AbstractTestCase extends TestCase
{
protected function tearDown(): void
{
Mockery::close();
\Mockery::close();
}

/**
Expand Down
7 changes: 3 additions & 4 deletions tests/Stub/ContainerStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use Hyperf\Utils\ApplicationContext;
use Hyperf\Utils\Codec\Json;
use KY\WorkWxUser\WeChat\WeChatFactory;
use Mockery;
use Psr\Container\ContainerInterface;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Log\NullLogger;
Expand All @@ -35,7 +34,7 @@ class ContainerStub
{
public static function mockContainer(): ContainerInterface
{
$container = Mockery::mock(ContainerInterface::class);
$container = \Mockery::mock(ContainerInterface::class);
$container->shouldReceive('get')->with(ConfigInterface::class)->andReturnUsing(function () {
$file = BASE_PATH . '/.env.json';
if (file_exists($file)) {
Expand Down Expand Up @@ -64,10 +63,10 @@ public static function mockContainer(): ContainerInterface
if ($isMockery) {
$config = $container->get(ConfigInterface::class)->get('work_wx_user');
$application = new Application($config);
$application->setHttpClient($client = Mockery::mock(HttpClientInterface::class));
$application->setHttpClient($client = \Mockery::mock(HttpClientInterface::class));
$client->shouldReceive('request')->withAnyArgs()->andReturnUsing(function (string $method, string $url, array $options) {
$path = __DIR__ . '/json/' . $method . str_replace('/', '_', $url) . '.json';
$response = Mockery::mock(ResponseInterface::class);
$response = \Mockery::mock(ResponseInterface::class);
$response->shouldReceive('toArray')->andReturn(
Json::decode(file_get_contents($path))
);
Expand Down