Exemple #1
0
 public function testCheckAccessRightsChecksSubshopAdminShop()
 {
     $session = Registry::getSession();
     $backUpAuth = $session->getVariable("auth");
     $exception = null;
     try {
         $utils = $this->getMock('OxidEsales\\EshopCommunity\\Core\\Utils', array('fetchRightsForUser', 'fetchShopAdminById'));
         $utils->expects($this->any())->method('fetchRightsForUser')->will($this->returnValue(1));
         $utils->expects($this->any())->method('fetchShopAdminById')->will($this->returnValue(1));
         $session->setVariable("auth", "blafooUser");
         $this->assertEquals(true, $utils->checkAccessRights());
         $this->setRequestParameter('fnc', 'chshp');
         $this->assertEquals(false, $utils->checkAccessRights());
         $this->setRequestParameter('fnc', null);
         $this->assertEquals(true, $utils->checkAccessRights());
         $this->setRequestParameter('actshop', 1);
         $this->assertEquals(true, $utils->checkAccessRights());
         $this->setRequestParameter('actshop', 2);
         $this->assertEquals(false, $utils->checkAccessRights());
         $this->setRequestParameter('actshop', null);
         $this->assertEquals(true, $utils->checkAccessRights());
         $this->setRequestParameter('shp', 1);
         $this->assertEquals(true, $utils->checkAccessRights());
         $this->setRequestParameter('shp', 2);
         $this->assertEquals(false, $utils->checkAccessRights());
         $this->setRequestParameter('shp', null);
         $this->assertEquals(true, $utils->checkAccessRights());
         $this->setRequestParameter('currentadminshop', 1);
         $this->assertEquals(true, $utils->checkAccessRights());
         $this->setRequestParameter('currentadminshop', 2);
         $this->assertEquals(false, $utils->checkAccessRights());
         $this->setRequestParameter('currentadminshop', null);
         $this->assertEquals(true, $utils->checkAccessRights());
     } catch (Exception $exception) {
     }
     $session->setVariable("auth", $backUpAuth);
     if ($exception) {
         throw $exception;
     }
 }
 public function testGetSession()
 {
     $oSubj = Registry::getSession();
     $this->assertTrue($oSubj instanceof \OxidEsales\EshopCommunity\Core\Session);
 }