userExists('limitedUser')) { // create non super user UsersManagerAPI::getInstance()->addUser('limitedUser', 'smartypants', 'user@limited.com'); UsersManagerAPI::getInstance()->setUserAccess('limitedUser', 'view', array(2, 3)); $userModel = new UsersManagerModel(); $userModel->addTokenAuth('limitedUser', self::$userTokenAuth, 'desc', '2020-01-02 03:04:05'); } } public function getApiForTesting() { $dateTime = substr(self::$fixture->dateTime, 0, 10); return [ // should return all websites as super user has access to all ['VisitsSummary.get', ['idSite' => 'all', 'date' => $dateTime, 'period' => 'day', 'format' => 'csv'], [ 'testSuffix' => 'superuser'] ], // should only return results for sites the user has access to (2,3) ['VisitsSummary.get', ['idSite' => 'all', 'date' => $dateTime, 'period' => 'day', 'format' => 'csv', 'token_auth' => self::$userTokenAuth], [ 'testSuffix' => 'user'] ], ]; } /** * @dataProvider getApiForTesting */ public function testApi($api, $params, $options) { $this->runAnyApiTest($api, '', $params, $options); } } AllWebsitesTest::$fixture = new ThreeSitesWithSharedVisitors();