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


PHP FakeAccess::identity方法代码示例

本文整理汇总了PHP中Piwik\Tests\Framework\Mock\FakeAccess::identity方法的典型用法代码示例。如果您正苦于以下问题:PHP FakeAccess::identity方法的具体用法?PHP FakeAccess::identity怎么用?PHP FakeAccess::identity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Tests\Framework\Mock\FakeAccess的用法示例。


在下文中一共展示了FakeAccess::identity方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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));
 }
开发者ID:ahdinosaur,项目名称:analytics.dinosaur.is,代码行数:40,代码来源:ApiTest.php

示例3: setNonAdminUser

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

示例4: setAnonymous

 private function setAnonymous()
 {
     FakeAccess::clearAccess();
     FakeAccess::$identity = 'anonymous';
 }
开发者ID:JoeHorn,项目名称:piwik,代码行数:5,代码来源:ApiTest.php

示例5: setIdentity

 private function setIdentity($login)
 {
     FakeAccess::$identity = $login;
     FakeAccess::$superUser = true;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:5,代码来源:ScheduledReportsTest.php

示例6: 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

示例7: setAnonymousUser

 protected function setAnonymousUser()
 {
     FakeAccess::clearAccess();
     FakeAccess::$identity = 'anonymous';
 }
开发者ID:ep123,项目名称:plugin-CustomDimensions,代码行数:5,代码来源:ApiTest.php

示例8: testUpdateUserIAmNotTheUser

 /**
  * check to modify as being another user => exception
  *
  * @expectedException \Exception
  */
 public function testUpdateUserIAmNotTheUser()
 {
     FakeAccess::$identity = 'login2';
     FakeAccess::$superUser = false;
     $this->testUpdateUserNoEmailNoAlias();
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:11,代码来源:UsersManagerTest.php

示例9: setUser

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

示例10: FakeAccess

    }
}), '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) {
    $useOverrideCss = \Piwik\Container\StaticContainer::get('test.vars.useOverrideCss');
    if ($useOverrideCss) {
        $stylesheets[] = 'tests/resources/screenshot-override/override.css';
    }
}), array('AssetManager.getJavaScriptFiles', function (&$jsFiles) {
    $useOverrideJs = \Piwik\Container\StaticContainer::get('test.vars.useOverrideJs');
开发者ID:diosmosis,项目名称:piwik,代码行数:31,代码来源:test.php


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