当前位置: 首页>>代码示例>>PHP>>正文


PHP FakeAccess::idSitesView方法代码示例

本文整理汇总了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';
 }
开发者ID:andrzejewsky,项目名称:plugin-CustomAlerts,代码行数:7,代码来源:BaseTest.php

示例2: setNonAdminUser

 protected function setNonAdminUser()
 {
     FakeAccess::setSuperUserAccess(false);
     FakeAccess::$idSitesView = array(99);
     FakeAccess::$identity = 'aUser';
 }
开发者ID:GovanifY,项目名称:piwik,代码行数:6,代码来源:APITest.php

示例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();
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:22,代码来源:AnnotationsTest.php

示例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);
 }
开发者ID:andrzejewsky,项目名称:plugin-CustomAlerts,代码行数:22,代码来源:ApiTest.php

示例5: setUser

 protected function setUser()
 {
     FakeAccess::clearAccess(false);
     FakeAccess::$idSitesView = array(1);
     FakeAccess::$idSitesAdmin = array();
     FakeAccess::$identity = 'aUser';
 }
开发者ID:ep123,项目名称:plugin-CustomDimensions,代码行数:7,代码来源:ApiTest.php

示例6: setUser

 private function setUser()
 {
     FakeAccess::$idSitesView = array(1);
     FakeAccess::$identity = 'userLogin';
     $this->createSettings();
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:6,代码来源:APITest.php

示例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) {
开发者ID:diosmosis,项目名称:piwik,代码行数:31,代码来源:test.php

示例8: setUser

 protected function setUser()
 {
     FakeAccess::clearAccess();
     FakeAccess::$idSitesView = array(1);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:5,代码来源:IntegrationTestCase.php


注:本文中的Piwik\Tests\Framework\Mock\FakeAccess::idSitesView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。