NerdsAndCompany\Schematic\Services\CategoryGroups::export PHP Метод

export() публичный Метод

Export categoryGroups.
public export ( array $categoryGroups = [] ) : array
$categoryGroups array
Результат array
    public function export(array $categoryGroups = [])
    {
        Craft::log(Craft::t('Exporting Category Groups'));
        $categoryGroupDefinitions = [];
        foreach ($categoryGroups as $categoryGroup) {
            $categoryGroupDefinitions[$categoryGroup->handle] = $this->getCategoryGroupDefinition($categoryGroup);
        }
        return $categoryGroupDefinitions;
    }

Usage Example

Пример #1
0
 /**
  * @covers ::export
  * @dataProvider provideValidCategoryGroups
  *
  * @param CategoryGroupModel[] $groups
  * @param array                $expectedResult
  */
 public function testSuccessfulExport(array $groups, array $expectedResult = [])
 {
     $this->setMockFieldsService();
     $this->setMockSchematicFields();
     $schematicCategoryGroupsService = new CategoryGroups();
     $actualResult = $schematicCategoryGroupsService->export($groups);
     $this->assertSame($expectedResult, $actualResult);
 }