forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2.3-develop] [ForwardPort] Port of magento#12285 The option <var nam…
…e="allowfullscreen">false</var> for mobile device don't work in product view page gallery Change the type of config variables of values "true" and "false" to type boolean, instead of string.
- Loading branch information
gwharton
committed
May 5, 2018
1 parent
4f9b705
commit 435b165
Showing
2 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
dev/tests/integration/testsuite/Magento/Framework/Config/ConverterTest.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,92 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Framework\Config; | ||
|
||
use Magento\Framework\ObjectManagerInterface; | ||
|
||
/** | ||
* Tests Magento\Framework\Config\Convert | ||
*/ | ||
class ConverterTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var ObjectManagerInterface | ||
*/ | ||
private $objectManager; | ||
|
||
/** | ||
* @var Converter | ||
*/ | ||
private $converter; | ||
|
||
/** | ||
* Tests config value "false" is not interpreted as true. | ||
* | ||
* @param string $sourceString | ||
* @param array $expected | ||
* @dataProvider parseVarElementDataProvider | ||
*/ | ||
public function testParseVarElement($sourceString, $expected) | ||
{ | ||
$document = new \DOMDocument(); | ||
$document->loadXML($sourceString); | ||
$actual = $this->converter->convert($document); | ||
|
||
self::assertEquals( | ||
$expected, | ||
$actual | ||
); | ||
} | ||
|
||
/** | ||
* Data provider for testParseVarElement. | ||
* | ||
* @return array | ||
*/ | ||
public function parseVarElementDataProvider() | ||
{ | ||
$sourceString = <<<'XML' | ||
<?xml version="1.0"?> | ||
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd"> | ||
<vars module="Magento_Test"> | ||
<var name="str">some string</var> | ||
<var name="int-1">1</var> | ||
<var name="int-0">0</var> | ||
<var name="bool-true">true</var> | ||
<var name="bool-false">false</var> | ||
</vars> | ||
</view> | ||
XML; | ||
$expectedResult = [ | ||
'vars' => [ | ||
'Magento_Test' => [ | ||
'str' => 'some string', | ||
'int-1' => '1', | ||
'int-0' => '0', | ||
'bool-true' => true, | ||
'bool-false' => false | ||
] | ||
] | ||
]; | ||
|
||
return [ | ||
[ | ||
$sourceString, | ||
$expectedResult | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); | ||
$this->converter = $this->objectManager->get(Converter::class); | ||
} | ||
} |
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