File tree Expand file tree Collapse file tree 2 files changed +66
-1
lines changed
app/code/Magento/Directory/Setup/Patch/Data
dev/tests/integration/testsuite/Magento/Directory/Model Expand file tree Collapse file tree 2 files changed +66
-1
lines changed Original file line number Diff line number Diff line change 3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
-
7
6
declare (strict_types=1 );
8
7
9
8
namespace Magento \Directory \Setup \Patch \Data ;
@@ -51,12 +50,15 @@ public function apply()
51
50
$ this ->moduleDataSetup ->getConnection (),
52
51
$ this ->getDataForItaly ()
53
52
);
53
+
54
+ return $ this ;
54
55
}
55
56
56
57
/**
57
58
* Italy states data.
58
59
*
59
60
* @return array
61
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
60
62
*/
61
63
private function getDataForItaly ()
62
64
{
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \Directory \Model \Country \Postcode \Config ;
9
+
10
+ use Magento \Directory \Model \Country ;
11
+ use Magento \TestFramework \Helper \Bootstrap ;
12
+ use PHPUnit \Framework \TestCase ;
13
+
14
+ class RegionTest extends TestCase
15
+ {
16
+ /**
17
+ * @var Country
18
+ */
19
+ protected $ country ;
20
+
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ public function setUp ()
25
+ {
26
+ $ this ->country = Bootstrap::getObjectManager ()->create (Country::class);
27
+ }
28
+
29
+ /**
30
+ * Verify country has regions.
31
+ *
32
+ * @var string $countryId
33
+ * @dataProvider getCountryIdDataProvider
34
+ */
35
+ public function testCountryHasRegions ($ countryId )
36
+ {
37
+ $ country = $ this ->country ->loadByCode ($ countryId );
38
+ $ region = $ country ->getRegions ()->getItems ();
39
+
40
+ $ this ->assertTrue (!empty ($ region ), 'Country ' . $ countryId . ' not have regions ' );
41
+ }
42
+
43
+ /**
44
+ * Data provider for testCountryHasRegions
45
+ *
46
+ * @return array
47
+ */
48
+ public function getCountryIdDataProvider ():array
49
+ {
50
+ return [
51
+ ['countryId ' => 'US ' ],
52
+ ['countryId ' => 'CA ' ],
53
+ ['countryId ' => 'CN ' ],
54
+ ['countryId ' => 'IN ' ],
55
+ ['countryId ' => 'AU ' ],
56
+ ['countryId ' => 'BE ' ],
57
+ ['countryId ' => 'CO ' ],
58
+ ['countryId ' => 'MX ' ],
59
+ ['countryId ' => 'PL ' ],
60
+ ['countryId ' => 'IT ' ]
61
+ ];
62
+ }
63
+ }
You can’t perform that action at this time.
0 commit comments