Пример #1
0
 private function setSiteManagerApiMock()
 {
     $sitesInfo = $this->sitesInfo;
     $mock = $this->getMock('stdClass', array('getSiteFromId'));
     $mock->expects($this->any())->method('getSiteFromId')->willReturnCallback(function ($idSite) use($sitesInfo) {
         return $sitesInfo[$idSite];
     });
     SitesManagerAPI::setSingletonInstance($mock);
 }
 private function setSitesManagerApiMock()
 {
     $mock = $this->getMock('stdClass', array('getSitesIdWithAtLeastViewAccess', 'getAllSitesId'));
     $mock->expects($this->any())->method('getSitesIdWithAtLeastViewAccess')->willReturn(array(1, 2, 3, 4, 5, 6));
     $mock->expects($this->any())->method('getAllSitesId')->willReturn(array(1, 2, 3, 4, 5, 6));
     SitesManagerAPI::setSingletonInstance($mock);
 }