本文整理汇总了PHP中Piwik\Tests\Framework\Mock\FakeAccess::idSitesView方法的典型用法代码示例。如果您正苦于以下问题:PHP FakeAccess::idSitesView方法的具体用法?PHP FakeAccess::idSitesView怎么用?PHP FakeAccess::idSitesView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Tests\Framework\Mock\FakeAccess
的用法示例。
在下文中一共展示了FakeAccess::idSitesView方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUser
protected function setUser()
{
FakeAccess::$superUser = false;
FakeAccess::$idSitesAdmin = array();
FakeAccess::$idSitesView = array(99);
FakeAccess::$identity = 'aUser';
}
示例2: setNonAdminUser
protected function setNonAdminUser()
{
FakeAccess::setSuperUserAccess(false);
FakeAccess::$idSitesView = array(99);
FakeAccess::$identity = 'aUser';
}
示例3: testMethodPermissions
/**
* @dataProvider getPermissionsFailData
*/
public function testMethodPermissions($hasAdminAccess, $hasViewAccess, $request, $checkException, $failMessage)
{
// create fake access that denies user access
FakeAccess::$superUser = false;
FakeAccess::$idSitesAdmin = $hasAdminAccess ? array(self::$fixture->idSite1) : array();
FakeAccess::$idSitesView = $hasViewAccess ? array(self::$fixture->idSite1) : array();
if ($checkException) {
try {
$request = new Request($request);
$request->process();
$this->fail($failMessage);
} catch (Exception $ex) {
// pass
}
} else {
$request = new Request($request);
$request->process();
}
}
示例4: test_getTriggeredAlerts_ShouldReturnAllThatMatchesLoginAndIdSite
public function test_getTriggeredAlerts_ShouldReturnAllThatMatchesLoginAndIdSite()
{
$idSite = 1;
$this->setSuperUser();
$this->model->triggerAlert(2, $idSite, 99, 48, Date::now()->getDatetime());
$triggeredAlerts = $this->api->getTriggeredAlerts(array($idSite));
$this->assertCount(1, $triggeredAlerts);
$triggeredAlerts = $this->api->getTriggeredAlerts(array($idSite, 2));
$this->assertCount(1, $triggeredAlerts);
// no matching site
$triggeredAlerts = $this->api->getTriggeredAlerts(array(2));
$this->assertCount(0, $triggeredAlerts);
// different login
FakeAccess::$identity = 'differentLoginButStillSuperuser';
$triggeredAlerts = $this->api->getTriggeredAlerts(array($idSite, 2));
$this->assertCount(0, $triggeredAlerts);
// different login
$this->setUser();
FakeAccess::$idSitesView = array(1);
$triggeredAlerts = $this->api->getTriggeredAlerts(array(1));
$this->assertCount(0, $triggeredAlerts);
}
示例5: setUser
protected function setUser()
{
FakeAccess::clearAccess(false);
FakeAccess::$idSitesView = array(1);
FakeAccess::$idSitesAdmin = array();
FakeAccess::$identity = 'aUser';
}
示例6: setUser
private function setUser()
{
FakeAccess::$idSitesView = array(1);
FakeAccess::$identity = 'userLogin';
$this->createSettings();
}
示例7: TestConfig
$dontUseTestConfig = $c->get('test.vars.dontUseTestConfig');
if (!$dontUseTestConfig) {
$settingsProvider = $c->get('Piwik\\Application\\Kernel\\GlobalSettingsProvider');
return new TestConfig($settingsProvider, $testingEnvironment, $allowSave = false, $doSetTestEnvironment = true);
} else {
return $previous;
}
}), 'Piwik\\Access' => DI\decorate(function ($previous, ContainerInterface $c) {
$testUseMockAuth = $c->get('test.vars.testUseMockAuth');
if ($testUseMockAuth) {
$idSitesAdmin = $c->get('test.vars.idSitesAdminAccess');
$idSitesView = $c->get('test.vars.idSitesViewAccess');
$access = new FakeAccess();
if (!empty($idSitesView)) {
FakeAccess::$superUser = false;
FakeAccess::$idSitesView = $idSitesView;
FakeAccess::$idSitesAdmin = !empty($idSitesAdmin) ? $idSitesAdmin : array();
FakeAccess::$identity = 'viewUserLogin';
} elseif (!empty($idSitesAdmin)) {
FakeAccess::$superUser = false;
FakeAccess::$idSitesAdmin = $idSitesAdmin;
FakeAccess::$identity = 'adminUserLogin';
} else {
FakeAccess::$superUser = true;
FakeAccess::$superUserLogin = 'superUserLogin';
}
return $access;
} else {
return $previous;
}
}), 'observers.global' => DI\add(array(array('AssetManager.getStylesheetFiles', function (&$stylesheets) {
示例8: setUser
protected function setUser()
{
FakeAccess::clearAccess();
FakeAccess::$idSitesView = array(1);
}