File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed
integration/testsuite/Magento/Backend/Model/Locale
static/testsuite/Magento/Test/Php/_files/phpmd Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,38 @@ public function testSetLocaleWithRequestLocale()
76
76
$ this ->_checkSetLocale ('de_DE ' );
77
77
}
78
78
79
+ /**
80
+ * Tests setLocale() with parameter
81
+ *
82
+ * @param string|null $localeParam
83
+ * @param string|null $localeRequestParam
84
+ * @param string $localeExpected
85
+ * @dataProvider setLocaleWithParameterDataProvider
86
+ */
87
+ public function testSetLocaleWithParameter (
88
+ ?string $ localeParam ,
89
+ ?string $ localeRequestParam ,
90
+ string $ localeExpected
91
+ ) {
92
+ $ request = Bootstrap::getObjectManager ()
93
+ ->get (\Magento \Framework \App \RequestInterface::class);
94
+ $ request ->setPostValue (['locale ' => $ localeRequestParam ]);
95
+ $ this ->_model ->setLocale ($ localeParam );
96
+ $ this ->assertEquals ($ localeExpected , $ this ->_model ->getLocale ());
97
+ }
98
+
99
+ /**
100
+ * @return array
101
+ */
102
+ public function setLocaleWithParameterDataProvider (): array
103
+ {
104
+ return [
105
+ ['ko_KR ' , 'ja_JP ' , 'ja_JP ' ],
106
+ ['ko_KR ' , null , 'ko_KR ' ],
107
+ [null , 'ja_JP ' , 'ja_JP ' ],
108
+ ];
109
+ }
110
+
79
111
/**
80
112
* Check set locale
81
113
*
Original file line number Diff line number Diff line change 29
29
<rule ref =" rulesets/unusedcode.xml" />
30
30
31
31
<!-- Code design rules -->
32
- <rule ref =" rulesets/design.xml/ExitExpression" />
33
- <rule ref =" rulesets/design.xml/EvalExpression" />
34
- <rule ref =" rulesets/design.xml/GotoStatement" />
35
32
<rule ref =" rulesets/design.xml/NumberOfChildren" />
36
33
<rule ref =" rulesets/design.xml/DepthOfInheritance" >
37
34
<properties >
You can’t perform that action at this time.
0 commit comments