public function testTimezone() { $expected = 'Europe/London'; $this->assertNull($this->user->getTimezone()); $this->assertSame($this->user, $this->user->setTimezone($expected)); $this->assertEquals($expected, $this->user->getTimezone()); }
public function testUpdateUser() { $userData = json_decode(file_get_contents(__DIR__ . '/../dummy_response_data/getUser.json'), true); // Set mocked response $body = new Stream(fopen(__DIR__ . '/../dummy_response_data/getUser.json', 'r')); $this->subscriber->addResponse(new Response(200, [], $body)); $user = new User(); $user->setUserId('123')->setEmail('*****@*****.**')->setFullName('EDITED'); $this->client->updateUser($user); // Test that the user has been populated with the response data $this->assertEquals($userData['userId'], $user->getUserId()); $this->assertEquals($userData['username'], $user->getUsername()); $this->assertEquals($userData['provider'], $user->getProvider()); $this->assertInstanceOf('DateTime', $user->getDateOfBirth()); $this->assertEquals($userData['dateOfBirth']['date'], $user->getDateOfBirth()->format('Y-m-d H:i:s')); $this->assertNull($user->getTimezone()); }
/** * Returns the list of most recent updates for certain user * * @param User|string $user A User model or userId * @param int $maxCount * @return Collection|Update[] */ public function getUserLastUpdates($user, $maxCount = null) { $queryParams = []; if (is_int($maxCount)) { $queryParams['minCount'] = $maxCount; } $route = new Route(self::USER_LAST_UPDATES, ['userId' => $user instanceof User ? $user->getUserId() : $user], $queryParams); return $this->getResourceCollection($route, 'lastUpdates', 'Wonnova\\SDK\\Model\\Update'); }