-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-59258: [Github] Override module-directory/etc/zip_codes.xml o…
…nly the last code of a country gets included #6694
- Loading branch information
Stanislav Idolov
committed
Oct 21, 2016
1 parent
c7d18bd
commit cec25e1
Showing
5 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
dev/tests/integration/_files/Magento/TestModuleDirectoryZipCodes/etc/module.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="Magento_TestModuleDirectoryZipCodes" setup_version="0.0.1" active="true"> | ||
<sequence> | ||
<module name="Magento_Directory"/> | ||
</sequence> | ||
</module> | ||
</config> |
14 changes: 14 additions & 0 deletions
14
dev/tests/integration/_files/Magento/TestModuleDirectoryZipCodes/etc/zip_codes.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Directory:etc/zip_codes.xsd"> | ||
<zip countryCode="NL"> | ||
<codes> | ||
<code id="pattern_1" active="true" example="test1">^[0-9]{4}[a-zA-Z]{2}$</code> | ||
<code id="pattern_2" active="true" example="test2">^[0-5]{4}[a-z]{2}$</code> | ||
</codes> | ||
</zip> | ||
<zip countryCode="NL_NEW"> | ||
<codes> | ||
<code id="pattern_1" active="true" example="test1">^[0-2]{4}[A-Z]{2}$</code> | ||
</codes> | ||
</zip> | ||
</config> |
12 changes: 12 additions & 0 deletions
12
dev/tests/integration/_files/Magento/TestModuleDirectoryZipCodes/registration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
use Magento\Framework\Component\ComponentRegistrar; | ||
|
||
$registrar = new ComponentRegistrar(); | ||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleDirectoryZipCodes') === null) { | ||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleDirectoryZipCodes', __DIR__); | ||
} |
43 changes: 43 additions & 0 deletions
43
...ests/integration/testsuite/Magento/Directory/Model/Country/Postcode/Config/ReaderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Directory\Model\Country\Postcode\Config; | ||
|
||
class ReaderTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var \Magento\Directory\Model\Country\Postcode\Config\Reader | ||
*/ | ||
private $reader; | ||
|
||
protected function setUp() | ||
{ | ||
$this->reader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( | ||
\Magento\Directory\Model\Country\Postcode\Config\Reader::class | ||
); | ||
} | ||
|
||
public function testRead() | ||
{ | ||
$result = $this->reader->read(); | ||
|
||
$this->assertArrayHasKey('NL', $result); | ||
$this->assertArrayHasKey('pattern_1', $result['NL']); | ||
$this->assertArrayHasKey('pattern_2', $result['NL']); | ||
|
||
$this->assertEquals('test1', $result['NL']['pattern_1']['example']); | ||
$this->assertEquals('^[0-9]{4}[a-zA-Z]{2}$', $result['NL']['pattern_1']['pattern']); | ||
|
||
$this->assertEquals('test2', $result['NL']['pattern_2']['example']); | ||
$this->assertEquals('^[0-5]{4}[a-z]{2}$', $result['NL']['pattern_2']['pattern']); | ||
|
||
$this->assertArrayHasKey('NL_NEW', $result); | ||
$this->assertArrayHasKey('pattern_1', $result['NL_NEW']); | ||
|
||
$this->assertEquals('test1', $result['NL_NEW']['pattern_1']['example']); | ||
$this->assertEquals('^[0-2]{4}[A-Z]{2}$', $result['NL_NEW']['pattern_1']['pattern']); | ||
} | ||
} |