diff --git a/app/code/Magento/Directory/Setup/Patch/Data/AddDataForAlbania.php b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForAlbania.php new file mode 100644 index 0000000000000..14aaffa1857ef --- /dev/null +++ b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForAlbania.php @@ -0,0 +1,99 @@ +moduleDataSetup = $moduleDataSetup; + $this->dataInstallerFactory = $dataInstallerFactory; + } + + /** + * @inheritdoc + */ + public function apply() + { + /** @var DataInstaller $dataInstaller */ + $dataInstaller = $this->dataInstallerFactory->create(); + $dataInstaller->addCountryRegions( + $this->moduleDataSetup->getConnection(), + $this->getDataForAlbania() + ); + + return $this; + } + + /** + * Albania states data. + * + * @return array + */ + private function getDataForAlbania() + { + return [ + ['AL', 'AL-01', 'Berat'], + ['AL', 'AL-09', 'Dibër'], + ['AL', 'AL-02', 'Durrës'], + ['AL', 'AL-03', 'Elbasan'], + ['AL', 'AL-04', 'Fier'], + ['AL', 'AL-05', 'Gjirokastër'], + ['AL', 'AL-06', 'Korçë'], + ['AL', 'AL-07', 'Kukës'], + ['AL', 'AL-08', 'Lezhë'], + ['AL', 'AL-10', 'Shkodër'], + ['AL', 'AL-11', 'Tiranë'], + ['AL', 'AL-12', 'Vlorë'] + ]; + } + + /** + * @inheritdoc + */ + public static function getDependencies() + { + return [ + InitializeDirectoryData::class, + ]; + } + + /** + * @inheritdoc + */ + public function getAliases() + { + return []; + } +} diff --git a/app/code/Magento/Directory/Setup/Patch/Data/AddDataForDenmark.php b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForDenmark.php new file mode 100644 index 0000000000000..1415227a932e6 --- /dev/null +++ b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForDenmark.php @@ -0,0 +1,92 @@ +moduleDataSetup = $moduleDataSetup; + $this->dataInstallerFactory = $dataInstallerFactory; + } + + /** + * @inheritdoc + */ + public function apply() + { + /** @var DataInstaller $dataInstaller */ + $dataInstaller = $this->dataInstallerFactory->create(); + $dataInstaller->addCountryRegions( + $this->moduleDataSetup->getConnection(), + $this->getDataForDenmark() + ); + + return $this; + } + + /** + * Denmark states data. + * + * @return array + */ + private function getDataForDenmark() + { + return [ + ['DK', 'DK-84', 'Hovedstaden'], + ['DK', 'DK-82', 'Midtjylland'], + ['DK', 'DK-81', 'Nordjylland'], + ['DK', 'DK-85', 'Sjælland'], + ['DK', 'DK-83', 'Syddanmark'], + ]; + } + + /** + * @inheritdoc + */ + public static function getDependencies() + { + return [ + InitializeDirectoryData::class, + ]; + } + + /** + * @inheritdoc + */ + public function getAliases() + { + return []; + } +} diff --git a/app/code/Magento/Directory/Setup/Patch/Data/AddDataForGreece.php b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForGreece.php new file mode 100644 index 0000000000000..30b1021a3467d --- /dev/null +++ b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForGreece.php @@ -0,0 +1,102 @@ +moduleDataSetup = $moduleDataSetup; + $this->dataInstallerFactory = $dataInstallerFactory; + } + + /** + * @inheritdoc + */ + public function apply() + { + /** @var DataInstaller $dataInstaller */ + $dataInstaller = $this->dataInstallerFactory->create(); + $dataInstaller->addCountryRegions( + $this->moduleDataSetup->getConnection(), + $this->getDataForGreece() + ); + + return $this; + } + + /** + * Greece states data. + * + * @return array + */ + private function getDataForGreece() + { + return [ + ['GR', 'GR-A', 'Anatolikí Makedonía kai Thráki'], + ['GR', 'GR-I', 'Attikí'], + ['GR', 'GR-G', 'Dytikí Elláda'], + ['GR', 'GR-C', 'Dytikí Makedonía'], + ['GR', 'GR-F', 'Ionía Nísia'], + ['GR', 'GR-D', 'Ípeiros'], + ['GR', 'GR-B', 'Kentrikí Makedonía'], + ['GR', 'GR-M', 'Kríti'], + ['GR', 'GR-L', 'Nótio Aigaío'], + ['GR', 'GR-J', 'Pelopónnisos'], + ['GR', 'GR-H', 'Stereá Elláda'], + ['GR', 'GR-E', 'Thessalía'], + ['GR', 'GR-K', 'Vóreio Aigaío'], + ['GR', 'GR-69', 'Ágion Óros'] + + ]; + } + + /** + * @inheritdoc + */ + public static function getDependencies() + { + return [ + InitializeDirectoryData::class, + ]; + } + + /** + * @inheritdoc + */ + public function getAliases() + { + return []; + } +} diff --git a/app/code/Magento/Directory/Setup/Patch/Data/AddDataForIceland.php b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForIceland.php new file mode 100644 index 0000000000000..6339b8bb71db4 --- /dev/null +++ b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForIceland.php @@ -0,0 +1,95 @@ +moduleDataSetup = $moduleDataSetup; + $this->dataInstallerFactory = $dataInstallerFactory; + } + + /** + * @inheritdoc + */ + public function apply() + { + /** @var DataInstaller $dataInstaller */ + $dataInstaller = $this->dataInstallerFactory->create(); + $dataInstaller->addCountryRegions( + $this->moduleDataSetup->getConnection(), + $this->getDataForIceland() + ); + + return $this; + } + + /** + * Iceland states data. + * + * @return array + */ + private function getDataForIceland() + { + return [ + ['IS', 'IS-01', 'Höfuðborgarsvæði'], + ['IS', 'IS-02', 'Suðurnes'], + ['IS', 'IS-03', 'Vesturland'], + ['IS', 'IS-04', 'Vestfirðir'], + ['IS', 'IS-05', 'Norðurland vestra'], + ['IS', 'IS-06', 'Norðurland eystra'], + ['IS', 'IS-07', 'Austurland'], + ['IS', 'IS-08', 'Suðurland'] + ]; + } + + /** + * @inheritdoc + */ + public static function getDependencies() + { + return [ + InitializeDirectoryData::class, + ]; + } + + /** + * @inheritdoc + */ + public function getAliases() + { + return []; + } +} diff --git a/app/code/Magento/Directory/Setup/Patch/Data/AddDataForPortugal.php b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForPortugal.php new file mode 100644 index 0000000000000..2960d431f123a --- /dev/null +++ b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForPortugal.php @@ -0,0 +1,107 @@ +moduleDataSetup = $moduleDataSetup; + $this->dataInstallerFactory = $dataInstallerFactory; + } + + /** + * @inheritdoc + */ + public function apply() + { + /** @var DataInstaller $dataInstaller */ + $dataInstaller = $this->dataInstallerFactory->create(); + $dataInstaller->addCountryRegions( + $this->moduleDataSetup->getConnection(), + $this->getDataForPortugal() + ); + + return $this; + } + + /** + * Portugal states data. + * + * @return array + */ + private function getDataForPortugal() + { + return [ + ['PT', 'PT-01', 'Aveiro'], + ['PT', 'PT-02', 'Beja'], + ['PT', 'PT-03', 'Braga'], + ['PT', 'PT-04', 'Bragança'], + ['PT', 'PT-05', 'Castelo Branco'], + ['PT', 'PT-06', 'Coimbra'], + ['PT', 'PT-07', 'Évora'], + ['PT', 'PT-08', 'Faro'], + ['PT', 'PT-09', 'Guarda'], + ['PT', 'PT-10', 'Leiria'], + ['PT', 'PT-11', 'Lisboa'], + ['PT', 'PT-12', 'Portalegre'], + ['PT', 'PT-13', 'Porto'], + ['PT', 'PT-14', 'Santarém'], + ['PT', 'PT-15', 'Setúbal'], + ['PT', 'PT-16', 'Viana do Castelo'], + ['PT', 'PT-17', 'Vila Real'], + ['PT', 'PT-18', 'Viseu'], + ['PT', 'PT-20', 'Região Autónoma dos Açores'], + ['PT', 'PT-30', 'Região Autónoma da Madeira'] + ]; + } + + /** + * @inheritdoc + */ + public static function getDependencies() + { + return [ + InitializeDirectoryData::class, + ]; + } + + /** + * @inheritdoc + */ + public function getAliases() + { + return []; + } +} diff --git a/app/code/Magento/Directory/Setup/Patch/Data/AddDataForSweden.php b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForSweden.php new file mode 100644 index 0000000000000..b4bed72a726bd --- /dev/null +++ b/app/code/Magento/Directory/Setup/Patch/Data/AddDataForSweden.php @@ -0,0 +1,108 @@ +moduleDataSetup = $moduleDataSetup; + $this->dataInstallerFactory = $dataInstallerFactory; + } + + /** + * @inheritdoc + */ + public function apply() + { + /** @var DataInstaller $dataInstaller */ + $dataInstaller = $this->dataInstallerFactory->create(); + $dataInstaller->addCountryRegions( + $this->moduleDataSetup->getConnection(), + $this->getDataForSweden() + ); + + return $this; + } + + /** + * Swedish states data. + * + * @return array + */ + private function getDataForSweden() + { + return [ + ['SE', 'SE-K', 'Blekinge län'], + ['SE', 'SE-W', 'Dalarnas län'], + ['SE', 'SE-I', 'Gotlands län'], + ['SE', 'SE-X', 'Gävleborgs län'], + ['SE', 'SE-N', 'Hallands län'], + ['SE', 'SE-Z', 'Jämtlands län'], + ['SE', 'SE-F', 'Jönköpings län'], + ['SE', 'SE-H', 'Kalmar län'], + ['SE', 'SE-G', 'Kronobergs län'], + ['SE', 'SE-BD', 'Norrbottens län'], + ['SE', 'SE-M', 'Skåne län'], + ['SE', 'SE-AB', 'Stockholms län'], + ['SE', 'SE-D', 'Södermanlands län'], + ['SE', 'SE-C', 'Uppsala län'], + ['SE', 'SE-S', 'Värmlands län'], + ['SE', 'SE-AC', 'Västerbottens län'], + ['SE', 'SE-Y', 'Västernorrlands län'], + ['SE', 'SE-U', 'Västmanlands län'], + ['SE', 'SE-O', 'Västra Götalands län'], + ['SE', 'SE-T', 'Örebro län'], + ['SE', 'SE-E', 'Östergötlands län'] + ]; + } + + /** + * @inheritdoc + */ + public static function getDependencies() + { + return [ + InitializeDirectoryData::class, + ]; + } + + /** + * @inheritdoc + */ + public function getAliases() + { + return []; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Directory/Model/RegionTest.php b/dev/tests/integration/testsuite/Magento/Directory/Model/RegionTest.php index 774690617d861..44c8377f1eaf7 100644 --- a/dev/tests/integration/testsuite/Magento/Directory/Model/RegionTest.php +++ b/dev/tests/integration/testsuite/Magento/Directory/Model/RegionTest.php @@ -57,7 +57,13 @@ public function getCountryIdDataProvider():array ['countryId' => 'MX'], ['countryId' => 'PL'], ['countryId' => 'IT'], - ['countryId' => 'BG'] + ['countryId' => 'BG'], + ['countryId' => 'PT'], + ['countryId' => 'IS'], + ['countryId' => 'SE'], + ['countryId' => 'GR'], + ['countryId' => 'DK'], + ['countryId' => 'AL'] ]; } }