/** * @dataProvider provideDataGetWatchStatus * */ public function testGetWatchStatus($uuids, $dbResult, $result) { // give it a fake user id $watchedTopicItems = new WatchedTopicItems(User::newFromId(1), $this->mockDb($dbResult)); $res = $watchedTopicItems->getWatchStatus($uuids); $this->assertEquals(count($res), count($result)); foreach ($res as $key => $value) { $this->assertArrayHasKey($key, $result); $this->assertEquals($value, $result[$key]); } // false values for all uuids for anon users $watchedTopicItems = new WatchedTopicItems(User::newFromId(0), $this->mockDb($dbResult)); foreach ($watchedTopicItems->getWatchStatus($uuids) as $value) { $this->assertFalse($value); } }
/** * @param WatchedTopicItems $watchedTopicItems * @return User[] */ public static function getCurrentUser(WatchedTopicItems $watchedTopicItems) { return array($watchedTopicItems->getUser()); }