NerdsAndCompany\Schematic\Services\TagGroups::export PHP Method

export() public method

Export taggroups.
public export ( array $tagGroups = [] ) : array
$tagGroups array
return array
    public function export(array $tagGroups = [])
    {
        Craft::log(Craft::t('Exporting TagGroups'));
        $tagGroupDefinitions = [];
        foreach ($tagGroups as $tagGroup) {
            $tagGroupDefinitions[$tagGroup->handle] = $this->getTagGroupDefinition($tagGroup);
        }
        return $tagGroupDefinitions;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @covers ::export
  * @dataProvider provideValidTagGroups
  *
  * @param TagGroupModel[] $groups
  * @param array           $expectedResult
  */
 public function testSuccessfulExport(array $groups, array $expectedResult = [])
 {
     $this->setMockFieldsService();
     $this->setMockSchematicFields();
     $schematicTagGroupsService = new TagGroups();
     $actualResult = $schematicTagGroupsService->export($groups);
     $this->assertSame($expectedResult, $actualResult);
 }