php Piwik-Tests-Framework-Mock-FakeAccess类(方法)实例源码

下面列出了php Piwik-Tests-Framework-Mock-FakeAccess 类(方法)源码代码实例,从而了解它的用法。

作者:andrzejewsk    项目:plugin-CustomAlert   
protected function setUser()
 {
     FakeAccess::$superUser = false;
     FakeAccess::$idSitesAdmin = array();
     FakeAccess::$idSitesView = array(99);
     FakeAccess::$identity = 'aUser';
 }

作者:mgou-ne    项目:piwi   
/**
  * @dataProvider getUnitColumns
  * @group Core
  */
 public function testGetUnit($column, $expected)
 {
     Site::setSites(array(1 => array('name' => 'TestSite', 'currency' => 'EUR')));
     FakeAccess::$superUser = true;
     $actual = Metrics::getUnit($column, 1);
     $this->assertEquals($expected, $actual);
 }

作者:hongqua    项目:piwi   
public function setUp()
 {
     parent::setUp();
     FakeAccess::$superUser = true;
     $idSite = Fixture::createWebsite('2014-01-01 00:00:00');
     $this->builder = $this->makeBuilder(array('method' => 'MultiSites_getAll', 'idSite' => $idSite));
 }

作者:piwi    项目:piwi   
public function setUp()
 {
     parent::setUp();
     $settings = new GlobalSettingsProvider($this->configPath('global.ini.php'), $this->configPath('config.ini.php'), $this->configPath('common.config.ini.php'));
     $this->configReader = new ConfigReader($settings, new IniReader());
     FakeAccess::clearAccess($superUser = true);
 }

作者:mgou-ne    项目:piwi   
public function setUp()
 {
     parent::setUp();
     // setup the access layer
     FakeAccess::$superUser = true;
     Fixture::createWebsite('2015-01-01 00:00:00');
 }

作者:FluentDevelopmen    项目:piwi   
public function setUp()
 {
     parent::setUp();
     // setup the access layer
     FakeAccess::$superUser = true;
     ArchiveTableCreator::$tablesAlreadyInstalled = null;
 }

作者:dorelljame    项目:piwi   
public function setUp()
 {
     parent::setUp();
     // setup the access layer
     FakeAccess::$superUser = true;
     $this->manager = new SitesManager();
     $this->siteId = Fixture::createWebsite('2014-03-03 00:00:00');
 }

作者:FluentDevelopmen    项目:piwi   
public function setUp()
 {
     parent::setUp();
     // setup the access layer
     FakeAccess::$superUser = true;
     $this->idSiteAccess = APISitesManager::getInstance()->addSite("test", "http://test");
     \Piwik\Plugin\Manager::getInstance()->loadPlugins(array('ScheduledReports', 'MobileMessaging', 'MultiSites'));
     \Piwik\Plugin\Manager::getInstance()->installLoadedPlugins();
 }

作者:FluentDevelopmen    项目:piwi   
public function setUp()
 {
     parent::setUp();
     // setup the access layer
     FakeAccess::$superUser = true;
     for ($i = 0; $i < $this->site2; $i++) {
         Fixture::createWebsite('2015-01-01 00:00:00');
     }
 }

作者:Michael2008    项目:piwi   
public function setUp()
 {
     parent::setUp();
     // setup the access layer
     FakeAccess::$superUser = true;
     Manager::getInstance()->loadTrackerPlugins();
     Manager::getInstance()->loadPlugin('SitesManager');
     Visit::$dimensions = null;
 }

作者:andrzejewsk    项目:plugin-AnonymousPiwikUsageMeasuremen   
public function test_shouldAlwaysAddTrackingCallAndNotFail_IfUserIsAnonmyous()
 {
     $this->makePluginSettings();
     FakeAccess::clearAccess($superUser = false, array(), array(), $login = 'anonymous');
     $out = '';
     Piwik::postEvent('Template.jsGlobalVariables', array(&$out));
     $this->assertContains('var piwikUsageTracking = {"targets":[{"url"', $out);
     $this->assertContains('{"id":1,"name":"Access","value":"anonymous"}', $out);
 }

作者:FluentDevelopmen    项目:piwi   
public function setUp()
 {
     parent::setUp();
     $this->api = API::getInstance();
     FakeAccess::$superUser = true;
     Fixture::createWebsite('2014-01-01 00:00:00');
     Fixture::createWebsite('2014-01-01 00:00:00');
     Fixture::createWebsite('2014-01-01 00:00:00');
     $this->api->addUser($this->login, 'password', 'userlogin@password.de');
 }

作者:ahdinosau    项目:analytics.dinosaur.i   
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();
 }

作者:FluentDevelopmen    项目:piwi   
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)];
 }

作者:sgieh    项目:piwik-plugin-GoogleAuthenticato   
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);
 }

作者:FluentDevelopmen    项目:piwi   
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');
 }

作者:piwi    项目:plugin-AnonymousPiwikUsageMeasuremen   
public function test_getServerVisitCustomVariables_shouldReturnSystemReport()
 {
     FakeAccess::clearAccess($superUser = true);
     for ($i = 1; $i < 15; $i++) {
         if (!Fixture::siteCreated($i)) {
             Fixture::createWebsite('2014-01-01 00:00:00');
         }
     }
     for ($i = 1; $i < 9; $i++) {
         UsersApi::getInstance()->addUser($login = 'test' . $i, 'password0815', "lorem{$i}@piwik.org");
     }
     for ($i = 1; $i < 5; $i++) {
         SegmentApi::getInstance()->add('Segment' . $i, 'pageUrl%3D@inde');
     }
     $customVars = array(array('id' => 1, 'name' => 'Piwik Version', 'value' => '2.14.3'), array('id' => 2, 'name' => 'PHP Version', 'value' => '5.5.27'), array('id' => 3, 'name' => 'Num Users', 'value' => 8), array('id' => 4, 'name' => 'Num Websites', 'value' => 14), array('id' => 5, 'name' => 'Num Segments', 'value' => 4), array('id' => 6, 'name' => 'MySQL Version', 'value' => Db::get()->getServerVersion()));
     $this->assertSame($customVars, $this->customVars->getServerVisitCustomVariables());
 }

作者:JoeHor    项目:piwi   
private function setAnonymous()
 {
     FakeAccess::clearAccess();
     FakeAccess::$identity = 'anonymous';
 }

作者:Govanif    项目:piwi   
protected function setNonAdminUser()
 {
     FakeAccess::setSuperUserAccess(false);
     FakeAccess::$idSitesView = array(99);
     FakeAccess::$identity = 'aUser';
 }

作者:dorelljame    项目:piwi   
/**
  * @expectedException \Exception
  * @expectedExceptionMessage checkUserHasViewAccess
  */
 public function test_findSegment_ShouldThrowException_IfNotEnoughPermission()
 {
     FakeAccess::clearAccess($superUser = false, array(1));
     $segment = $this->list->findSegment('pageUrl', 999);
     $this->assertNull($segment);
 }


问题


面经


文章

微信
公众号

扫码关注公众号