55 */
66declare (strict_types=1 );
77
8- namespace Magento \Config \Controller \Adminhtml \System ;
8+ namespace Magento \Config \Controller \Adminhtml \System \ Config ;
99
1010use Magento \Config \Model \Config \Loader ;
1111use Magento \Framework \App \Request \Http as HttpRequest ;
@@ -41,17 +41,17 @@ public function setUp(): void
4141
4242 /**
4343 * @dataProvider saveConfigDataProvider
44+ * @magentoDbIsolation enabled
4445 * @param array $params
4546 * @param array $post
46- * @magentoDbIsolation enabled
4747 * @return void
4848 */
4949 public function testSaveConfig (array $ params , array $ post ): void
5050 {
5151 $ expectedPathValue = $ this ->prepareExpectedPathValue ($ params ['section ' ], $ post ['groups ' ]);
5252 $ this ->dispatchWithParams ($ params , $ post );
5353 $ this ->assertSessionMessages (
54- $ this ->equalTo ([ (string )__ ('You saved the configuration. ' )] ),
54+ $ this ->containsEqual ( (string )__ ('You saved the configuration. ' )),
5555 MessageInterface::TYPE_SUCCESS
5656 );
5757 $ this ->assertPathValue ($ expectedPathValue );
@@ -120,7 +120,6 @@ public function saveConfigDataProvider(): array
120120 */
121121 private function prepareExpectedPathValue (string $ section , array $ groups ): array
122122 {
123- $ expectedData = [];
124123 foreach ($ groups as $ groupId => $ groupData ) {
125124 $ groupPath = $ section . '/ ' . $ groupId ;
126125 foreach ($ groupData ['fields ' ] as $ fieldId => $ fieldData ) {
@@ -129,7 +128,7 @@ private function prepareExpectedPathValue(string $section, array $groups): array
129128 }
130129 }
131130
132- return $ expectedData ;
131+ return $ expectedData ?? [] ;
133132 }
134133
135134 /**
@@ -148,13 +147,18 @@ private function assertPathValue(array $expectedPathValue): void
148147 $ scope ->getId (),
149148 false
150149 );
151- $ filteredActualPathValue = [];
152150 foreach ($ groupData as $ fieldPath => $ fieldValue ) {
153- if (isset ($ actualPathValue [$ fieldPath ])) {
154- $ filteredActualPathValue [$ fieldPath ] = $ actualPathValue [$ fieldPath ];
155- }
151+ $ this ->assertArrayHasKey (
152+ $ fieldPath ,
153+ $ actualPathValue ,
154+ sprintf ('The expected config setting was not saved in the database. Path: %s ' , $ fieldPath )
155+ );
156+ $ this ->assertEquals (
157+ $ fieldValue ,
158+ $ actualPathValue [$ fieldPath ],
159+ sprintf ('The expected value of the config setting is not correct. Path: %s ' , $ fieldPath )
160+ );
156161 }
157- $ this ->assertEquals ($ groupData , $ filteredActualPathValue );
158162 }
159163 }
160164
0 commit comments