This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree 4 files changed +77
-2
lines changed
app/code/Magento/Theme/Model/Design/Config
dev/tests/integration/testsuite/Magento/Theme
4 files changed +77
-2
lines changed Original file line number Diff line number Diff line change @@ -87,10 +87,13 @@ public function load($scope, $scopeId)
87
87
$ scopeId ,
88
88
$ fieldData ->getFieldConfig ()
89
89
);
90
- if ($ value !== null ) {
91
- $ fieldData ->setValue ($ value );
90
+
91
+ if ($ value === null ) {
92
+ $ value = '' ;
92
93
}
94
+ $ fieldData ->setValue ($ value );
93
95
}
96
+
94
97
return $ designConfig ;
95
98
}
96
99
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
+
7
+ namespace Magento \Theme \Model \Design ;
8
+
9
+ /**
10
+ * Test for \Magento\Theme\Model\Design\Config\Storage.
11
+ */
12
+ class ConfigTest extends \PHPUnit \Framework \TestCase
13
+ {
14
+ /**
15
+ * @var \Magento\Theme\Model\Design\Config\Storage
16
+ */
17
+ private $ storage ;
18
+
19
+ protected function setUp ()
20
+ {
21
+ $ this ->storage = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (
22
+ \Magento \Theme \Model \Design \Config \Storage::class
23
+ );
24
+ }
25
+
26
+ /**
27
+ * Test design/header/welcome if it is saved in db as empty(null) it should be shown on backend as empty.
28
+ *
29
+ * @magentoDataFixture Magento/Theme/_files/config_data.php
30
+ */
31
+ public function testLoad ()
32
+ {
33
+ $ data = $ this ->storage ->load ('stores ' , 1 );
34
+ foreach ($ data ->getExtensionAttributes ()->getDesignConfigData () as $ configData ) {
35
+ if ($ configData ->getPath () == 'design/header/welcome ' ) {
36
+ $ this ->assertSame ('' , $ configData ->getValue ());
37
+ }
38
+ }
39
+ }
40
+ }
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
+
7
+ use Magento \Config \Model \Config \Factory ;
8
+ use Magento \TestFramework \Helper \Bootstrap ;
9
+
10
+ $ objectManager = Bootstrap::getObjectManager ();
11
+
12
+ /** @var Factory $configFactory */
13
+ $ configFactory = $ objectManager ->create (Factory::class);
14
+ /** @var \Magento\Config\Model\Config $config */
15
+ $ config = $ configFactory ->create ();
16
+ $ config ->setScope ('stores ' );
17
+ $ config ->setStore ('default ' );
18
+ $ config ->setDataByPath ('design/header/welcome ' , null );
19
+ $ config ->save ();
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
+
7
+ $ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
8
+ /** @var \Magento\Framework\App\ResourceConnection $resource */
9
+ $ resource = $ objectManager ->get (\Magento \Framework \App \ResourceConnection::class);
10
+ $ connection = $ resource ->getConnection ();
11
+ $ tableName = $ resource ->getTableName ('core_config_data ' );
12
+
13
+ $ connection ->query ("DELETE FROM $ tableName WHERE path = 'design/header/welcome'; " );
You can’t perform that action at this time.
0 commit comments