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

export() public method

Export user settings.
public export ( array $users = [] ) : array
$users array
return array
    public function export(array $users = [])
    {
        Craft::log(Craft::t('Exporting Users'));
        return $this->getUsersDefinition(new UserModel());
    }

Usage Example

Example #1
0
 /**
  * Test users service export.
  *
  * @covers ::export
  */
 public function testUsersServiceExport()
 {
     $mockI18n = $this->getMockLocalizationService();
     $mockFieldLayout = $this->getMockFieldLayout();
     $mockFieldsService = $this->getMockFieldsService();
     $mockFieldsService->expects($this->exactly(1))->method('getLayoutByType')->willReturn($mockFieldLayout);
     $mockSchematicFieldsService = $this->getMockSchematicFieldsService();
     $mockSchematicFieldsService->expects($this->exactly(1))->method('getFieldLayoutDefinition')->willReturn([]);
     $this->setComponent(Craft::app(), 'i18n', $mockI18n);
     $this->setComponent(Craft::app(), 'fields', $mockFieldsService);
     $this->setComponent(Craft::app(), 'schematic_fields', $mockSchematicFieldsService);
     $export = $this->schematicUsersService->export();
     $this->assertArrayHasKey('fieldLayout', $export);
 }