File tree Expand file tree Collapse file tree 4 files changed +77
-2
lines changed
app/code/Magento/Theme/Model/Design/Config
dev/tests/integration/testsuite/Magento/Theme Expand file tree Collapse file tree 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)
8787 $ scopeId ,
8888 $ fieldData ->getFieldConfig ()
8989 );
90- if ($ value !== null ) {
91- $ fieldData ->setValue ($ value );
90+
91+ if ($ value === null ) {
92+ $ value = '' ;
9293 }
94+ $ fieldData ->setValue ($ value );
9395 }
96+
9497 return $ designConfig ;
9598 }
9699
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