UserMetadataTest.php 950 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace tests;
  3. class UserMetadataTest extends Base
  4. {
  5. public function __construct()
  6. {
  7. parent::__construct();
  8. }
  9. public function testMetadataCycles()
  10. {
  11. $username = Utils::randomUserName();
  12. $password = Utils::randomPassword();
  13. $this->assertArrayNotHasKey('code', $this->user->create(array('username' => $username, 'password' => $password)));
  14. $data = array(
  15. 'nickname' => '昵称',
  16. 'avatar' => 'http://www.easemob.com/avatar.png',
  17. 'phone' => '159',
  18. );
  19. $this->assertTrue($this->metadata->setMetadataToUser($username, $data));
  20. $this->assertArrayNotHasKey('code', $this->metadata->getMetadataFromUser($username));
  21. $this->assertIsNumeric($this->metadata->getUsage());
  22. $this->assertIsBool($this->metadata->deleteMetadataFromUser($username));
  23. $this->assertTrue($this->user->delete($username));
  24. }
  25. }