-
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.
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #22081: phpcs error on rule classes - must be of the type integer (by @Nazar65) - #22012: Correct bug 21993 config:set not storing scoped values (by @ochnygosch) - #21999: #21998 Magento/ImportExport/Model/Import has _coreConfig declared dyn� (by @kisroman) - #21790: #21789 Fix gallery event observer (by @Den4ik) - #21023: Corrected the translation for comment tag (by @yogeshsuhagiya) - #20951: Direct STDERR output when listing crontab to /dev/null (by @danielatdattrixdotcom) Fixed GitHub Issues: - #20186: phpcs error on rule classes - must be of the type integer (reported by @ipascual) has been fixed in #22081 by @Nazar65 in 2.3-develop branch Related commits: 1. 223d8ef - #21993: config:set not storing scoped values (reported by @ochnygosch) has been fixed in #22012 by @ochnygosch in 2.3-develop branch Related commits: 1. f826017 2. d53690c - #21998: Magento/ImportExport/Model/Import has _coreConfig declared dynamically (reported by @kisroman) has been fixed in #21999 by @kisroman in 2.3-develop branch Related commits: 1. 1fe977a - #21789: [BUG] Product gallery opening by mistake (reported by @Den4ik) has been fixed in #21790 by @Den4ik in 2.3-develop branch Related commits: 1. 9b324e8 2. 55d5daa
- Loading branch information
Showing
16 changed files
with
228 additions
and
2,812 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
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
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
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
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
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
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
146 changes: 146 additions & 0 deletions
146
dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/ReaderTest.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,146 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Config\Model\Config\Structure\Reader; | ||
|
||
use Magento\Config\Model\Config\SchemaLocator; | ||
use Magento\Framework\App\Utility\Files; | ||
use Magento\Framework\Config\Dom; | ||
use Magento\Framework\Config\FileResolverInterface; | ||
use Magento\Framework\Config\ValidationStateInterface; | ||
use Magento\Framework\ObjectManagerInterface; | ||
use Magento\Framework\View\TemplateEngine\Xhtml\CompilerInterface; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
/** | ||
* Class ReaderTest check Magento\Config\Model\Config\Structure\Reader::_readFiles() method. | ||
*/ | ||
class ReaderTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* Test config location. | ||
* | ||
* @string | ||
*/ | ||
const CONFIG = '/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/_files/'; | ||
|
||
/** | ||
* @var ObjectManagerInterface | ||
*/ | ||
private $objectManager; | ||
|
||
/** | ||
* @var Files | ||
*/ | ||
private $fileUtility; | ||
|
||
/** | ||
* @var ValidationStateInterface | ||
*/ | ||
private $validationStateMock; | ||
|
||
/** | ||
* @var \Magento\Framework\Config\SchemaLocatorInterface | ||
*/ | ||
private $schemaLocatorMock; | ||
|
||
/** | ||
* @var FileResolverInterface | ||
*/ | ||
private $fileResolverMock; | ||
|
||
/** | ||
* @var ReaderStub | ||
*/ | ||
private $reader; | ||
|
||
/** | ||
* @var ConverterStub | ||
*/ | ||
private $converter; | ||
|
||
/** | ||
* @var CompilerInterface|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $compiler; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->objectManager = Bootstrap::getObjectManager(); | ||
$this->fileUtility = Files::init(); | ||
|
||
$this->validationStateMock = $this->getMockBuilder(ValidationStateInterface::class) | ||
->setMethods(['isValidationRequired']) | ||
->getMockForAbstractClass(); | ||
$this->schemaLocatorMock = $this->getMockBuilder(SchemaLocator::class) | ||
->disableOriginalConstructor() | ||
->setMethods(['getPerFileSchema']) | ||
->getMock(); | ||
$this->fileResolverMock = $this->getMockBuilder(FileResolverInterface::class) | ||
->getMockForAbstractClass(); | ||
|
||
$this->validationStateMock->expects($this->atLeastOnce()) | ||
->method('isValidationRequired') | ||
->willReturn(false); | ||
$this->schemaLocatorMock->expects($this->atLeastOnce()) | ||
->method('getPerFileSchema') | ||
->willReturn(false); | ||
|
||
$this->converter = $this->objectManager->create(ConverterStub::class); | ||
|
||
//Isolate test from actual configuration, and leave only sample data. | ||
$this->compiler = $this->getMockBuilder(CompilerInterface::class) | ||
->disableOriginalConstructor() | ||
->setMethods(['compile']) | ||
->getMockForAbstractClass(); | ||
|
||
$this->reader = $this->objectManager->create( | ||
ReaderStub::class, | ||
[ | ||
'fileResolver' => $this->fileResolverMock, | ||
'converter' => $this->converter, | ||
'schemaLocator' => $this->schemaLocatorMock, | ||
'validationState' => $this->validationStateMock, | ||
'fileName' => 'no_existing_file.xml', | ||
'compiler' => $this->compiler, | ||
'domDocumentClass' => Dom::class | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* The test checks the file structure after processing the nodes responsible for inserting content. | ||
* | ||
* @return void | ||
*/ | ||
public function testXmlConvertedConfigurationAndCompereStructure() | ||
{ | ||
$actual = $this->reader->readFiles(['actual' => $this->getContent()]); | ||
|
||
$document = new \DOMDocument(); | ||
$document->loadXML($this->getContent()); | ||
|
||
$expected = $this->converter->getArrayData($document); | ||
|
||
$this->assertEquals($expected, $actual); | ||
} | ||
|
||
/** | ||
* Get config sample data for test. | ||
* | ||
* @return string | ||
*/ | ||
protected function getContent() | ||
{ | ||
$files = $this->fileUtility->getFiles([BP . static::CONFIG], 'config.xml'); | ||
|
||
return file_get_contents(reset($files)); | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.