Exemple #1
0
 /**
  * Get data
  *
  * @param array $item
  * @return string
  */
 protected function prepareItem(array $item)
 {
     $content = '';
     $origStores = $item['store_id'];
     if (empty($origStores)) {
         return '';
     }
     if (!is_array($origStores)) {
         $origStores = [$origStores];
     }
     if (in_array(0, $origStores) && count($origStores) == 1) {
         return __('All Store Views');
     }
     $data = $this->systemStore->getStoresStructure(false, $origStores);
     foreach ($data as $website) {
         $content .= $website['label'] . "<br/>";
         foreach ($website['children'] as $group) {
             $content .= str_repeat('&nbsp;', 3) . $this->escaper->escapeHtml($group['label']) . "<br/>";
             foreach ($group['children'] as $store) {
                 $content .= str_repeat('&nbsp;', 6) . $this->escaper->escapeHtml($store['label']) . "<br/>";
             }
         }
     }
     return $content;
 }
 /**
  * @dataProvider getStoresStructureDataProvider
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function testGetStoresStructure($isAll, $storeId, $groupId, $websiteId, $storeName, $groupName, $websiteName, $storeIds, $groupIds, $websiteIds, $expectedResult)
 {
     $this->websiteMock->expects($this->any())->method('getId')->willReturn($websiteId);
     $this->websiteMock->expects($this->any())->method('getName')->willReturn($websiteName);
     $this->groupMock->expects($this->any())->method('getId')->willReturn($groupId);
     $this->groupMock->expects($this->any())->method('getName')->willReturn($groupName);
     $this->storeMock->expects($this->any())->method('getId')->willReturn($storeId);
     $this->storeMock->expects($this->any())->method('getName')->willReturn($storeName);
     $this->assertEquals($this->model->getStoresStructure($isAll, $storeIds, $groupIds, $websiteIds), $expectedResult);
 }
 /**
  * Rendering store visibility structure
  *
  * @param array $storeIds
  * @return string
  */
 protected function renderVisibilityStructure(array $storeIds)
 {
     $visibility = '';
     foreach ($this->store->getStoresStructure(false, $storeIds) as $website) {
         $visibility .= $website['label'] . '<br/>';
         foreach ($website['children'] as $group) {
             $visibility .= str_repeat('&nbsp;', 3) . $group['label'] . '<br/>';
             foreach ($group['children'] as $store) {
                 $visibility .= str_repeat('&nbsp;', 6) . $store['label'] . '<br/>';
             }
         }
     }
     return $visibility;
 }