UserTest.php 600 B

123456789101112131415161718192021222324
  1. <?php
  2. /*
  3. * This file is part of the overtrue/socialite.
  4. *
  5. * (c) overtrue <i@overtrue.me>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. use Overtrue\Socialite\AccessToken;
  11. use Overtrue\Socialite\User;
  12. use PHPUnit\Framework\TestCase;
  13. class UserTest extends TestCase
  14. {
  15. public function testJsonserialize()
  16. {
  17. $this->assertSame('[]', json_encode(new User([])));
  18. $this->assertSame('{"token":"mock-token"}', json_encode(new User(['token' => new AccessToken(['access_token' => 'mock-token'])])));
  19. }
  20. }