-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge forwardport of #12328 to 2.3-develop branch
Applied pull request patch https://github.com/magento/magento2/pull/12328.patch (created by @RomaKis) based on commit(s): 1. 147f638 Fixed GitHub Issues in 2.3-develop branch: - #9742: Default welcome message returns after being deleted (reported by @robgt)
- Loading branch information
Showing
4 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
dev/tests/integration/testsuite/Magento/Theme/Model/Design/ConfigTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Theme\Model\Design; | ||
|
||
/** | ||
* Test for \Magento\Theme\Model\Design\Config\Storage. | ||
*/ | ||
class ConfigTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var \Magento\Theme\Model\Design\Config\Storage | ||
*/ | ||
private $storage; | ||
|
||
protected function setUp() | ||
{ | ||
$this->storage = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( | ||
\Magento\Theme\Model\Design\Config\Storage::class | ||
); | ||
} | ||
|
||
/** | ||
* Test design/header/welcome if it is saved in db as empty(null) it should be shown on backend as empty. | ||
* | ||
* @magentoDataFixture Magento/Theme/_files/config_data.php | ||
*/ | ||
public function testLoad() | ||
{ | ||
$data = $this->storage->load('stores', 1); | ||
foreach ($data->getExtensionAttributes()->getDesignConfigData() as $configData) { | ||
if ($configData->getPath() == 'design/header/welcome') { | ||
$this->assertSame('', $configData->getValue()); | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
dev/tests/integration/testsuite/Magento/Theme/_files/config_data.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
use Magento\Config\Model\Config\Factory; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
$objectManager = Bootstrap::getObjectManager(); | ||
|
||
/** @var Factory $configFactory */ | ||
$configFactory = $objectManager->create(Factory::class); | ||
/** @var \Magento\Config\Model\Config $config */ | ||
$config = $configFactory->create(); | ||
$config->setScope('stores'); | ||
$config->setStore('default'); | ||
$config->setDataByPath('design/header/welcome', null); | ||
$config->save(); |
13 changes: 13 additions & 0 deletions
13
dev/tests/integration/testsuite/Magento/Theme/_files/config_data_rollback.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); | ||
/** @var \Magento\Framework\App\ResourceConnection $resource */ | ||
$resource = $objectManager->get(\Magento\Framework\App\ResourceConnection::class); | ||
$connection = $resource->getConnection(); | ||
$tableName = $resource->getTableName('core_config_data'); | ||
|
||
$connection->query("DELETE FROM $tableName WHERE path = 'design/header/welcome';"); |