本文整理汇总了PHP中Piwik\Tests\Framework\Mock\FakeAccess::setIdSitesView方法的典型用法代码示例。如果您正苦于以下问题:PHP FakeAccess::setIdSitesView方法的具体用法?PHP FakeAccess::setIdSitesView怎么用?PHP FakeAccess::setIdSitesView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Tests\Framework\Mock\FakeAccess
的用法示例。
在下文中一共展示了FakeAccess::setIdSitesView方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
// setup the access layer
FakeAccess::setIdSitesView(array(1, 2));
FakeAccess::setIdSitesAdmin(array(3, 4));
//finally we set the user as a Super User by default
FakeAccess::$superUser = true;
$this->auth = new Auth();
}
示例2: setUp
public function setUp()
{
parent::setUp();
// setup the access layer
FakeAccess::setIdSitesView(array(1, 2));
FakeAccess::setIdSitesAdmin(array(3, 4));
//finally we set the user as a Super User by default
FakeAccess::$superUser = true;
$user_agents = array('Mozilla/6.0 (Macintosh; I; Intel Mac OS X 11_7_9; de-LI; rv:1.9b4) Gecko/2012010317 Firefox/10.0a4', 'Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/18.6.872.0 Safari/535.2 UNTRUSTED/1.0 3gpp-gba UNTRUSTED/1.0', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1');
$_SERVER['HTTP_USER_AGENT'] = $user_agents[mt_rand(0, count($user_agents) - 1)];
}
示例3: setUp
public function setUp()
{
parent::setUp();
// setup the access layer
self::setSuperUser();
\Piwik\Plugin\Manager::getInstance()->loadPlugins(array('API', 'UserCountry', 'ScheduledReports', 'MobileMessaging', 'VisitsSummary', 'Referrers'));
\Piwik\Plugin\Manager::getInstance()->installLoadedPlugins();
APISitesManager::getInstance()->addSite("Test", array("http://piwik.net"));
APISitesManager::getInstance()->addSite("Test", array("http://piwik.net"));
FakeAccess::setIdSitesView(array($this->idSite, 2));
APIScheduledReports::$cache = array();
}
示例4: setUp
public function setUp()
{
parent::setUp();
// setup the access layer
FakeAccess::setIdSitesView(array(1, 2));
FakeAccess::setIdSitesAdmin(array(3, 4));
//finally we set the user as a Super User by default
FakeAccess::$superUser = true;
$this->auth = new Auth();
$ga = new GoogleAuthenticator();
$this->secret = $ga->createSecret(32);
}
示例5: setUp
public function setUp()
{
parent::setUp();
\Piwik\Plugin\Manager::getInstance()->loadPlugin('SegmentEditor');
\Piwik\Plugin\Manager::getInstance()->installLoadedPlugins();
// setup the access layer
FakeAccess::setIdSitesView(array(1, 2));
FakeAccess::setIdSitesAdmin(array(3, 4));
//finally we set the user as a Super User by default
FakeAccess::$superUser = true;
FakeAccess::$superUserLogin = 'superusertest';
APISitesManager::getInstance()->addSite('test', 'http://example.org');
}
示例6: setUp
public function setUp()
{
parent::setUp();
\Piwik\Plugin\Manager::getInstance()->loadPlugin('UsersManager');
\Piwik\Plugin\Manager::getInstance()->installLoadedPlugins();
// setup the access layer
FakeAccess::setIdSitesView(array(1, 2));
FakeAccess::setIdSitesAdmin(array(3, 4));
//finally we set the user as a Super User by default
FakeAccess::$superUser = true;
FakeAccess::$superUserLogin = 'superusertest';
$this->api = API::getInstance();
$this->model = Factory::getModel('Piwik\\Plugins\\UsersManager');
}
示例7: test_getSitesIdFromSiteUrl_asUser
public function test_getSitesIdFromSiteUrl_asUser()
{
API::getInstance()->addSite("site1", array("http://www.piwik.net", "https://piwik.com"));
API::getInstance()->addSite("site2", array("http://piwik.com", "http://piwik.net"));
API::getInstance()->addSite("site3", array("http://piwik.com", "http://piwik.org"));
APIUsersManager::getInstance()->addUser("user1", "geqgegagae", "tegst@tesgt.com", "alias");
APIUsersManager::getInstance()->setUserAccess("user1", "view", array(1));
APIUsersManager::getInstance()->addUser("user2", "geqgegagae", "tegst2@tesgt.com", "alias");
APIUsersManager::getInstance()->setUserAccess("user2", "view", array(1));
APIUsersManager::getInstance()->setUserAccess("user2", "admin", array(3));
APIUsersManager::getInstance()->addUser("user3", "geqgegagae", "tegst3@tesgt.com", "alias");
APIUsersManager::getInstance()->setUserAccess("user3", "view", array(1, 2));
APIUsersManager::getInstance()->setUserAccess("user3", "admin", array(3));
FakeAccess::$superUser = false;
FakeAccess::$identity = 'user1';
FakeAccess::setIdSitesView(array(1));
FakeAccess::setIdSitesAdmin(array());
$this->assertFalse(Piwik::hasUserSuperUserAccess());
$idsites = API::getInstance()->getSitesIdFromSiteUrl('http://piwik.com');
$this->assertEquals(1, count($idsites));
// testing URL normalization
$idsites = API::getInstance()->getSitesIdFromSiteUrl('http://www.piwik.com');
$this->assertEquals(1, count($idsites));
$idsites = API::getInstance()->getSitesIdFromSiteUrl('http://piwik.net');
$this->assertEquals(1, count($idsites));
FakeAccess::$superUser = false;
FakeAccess::$identity = 'user2';
FakeAccess::setIdSitesView(array(1));
FakeAccess::setIdSitesAdmin(array(3));
$idsites = API::getInstance()->getSitesIdFromSiteUrl('http://piwik.com');
$this->assertEquals(2, count($idsites));
FakeAccess::$superUser = false;
FakeAccess::$identity = 'user3';
FakeAccess::setIdSitesView(array(1, 2));
FakeAccess::setIdSitesAdmin(array(3));
$idsites = API::getInstance()->getSitesIdFromSiteUrl('http://piwik.com');
$this->assertEquals(3, count($idsites));
$idsites = API::getInstance()->getSitesIdFromSiteUrl('https://www.piwik.com');
$this->assertEquals(3, count($idsites));
}
示例8: testSetValue_shouldThrowException_IfOnlyViewPermission
/**
* @expectedException \Exception
* @expectedExceptionMessage CoreAdminHome_PluginSettingChangeNotAllowed
*/
public function testSetValue_shouldThrowException_IfOnlyViewPermission()
{
FakeAccess::clearAccess();
FakeAccess::setIdSitesView(array(1, 2, 3));
$this->createSetting()->setValue('test');
}