diff --git a/app/code/Magento/Backend/etc/menu.xsd b/app/code/Magento/Backend/etc/menu.xsd
index 311bc95d85aaa..5ba2e6a84e93e 100644
--- a/app/code/Magento/Backend/etc/menu.xsd
+++ b/app/code/Magento/Backend/etc/menu.xsd
@@ -131,7 +131,7 @@
-
+
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php
new file mode 100644
index 0000000000000..885210800ed13
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php
@@ -0,0 +1,36 @@
+create('Magento\Framework\Data\Form\ElementFactory');
+ $this->imageElement = $elementFactory->create('Magento\Framework\Data\Form\Element\Image', []);
+ $form = $objectManager->create('Magento\Framework\Data\Form');
+ $this->imageElement->setForm($form);
+ }
+
+ public function testGetElementHtml()
+ {
+ $filePath = 'some/path/to/file.jpg';
+ $this->imageElement->setValue($filePath);
+ $html = $this->imageElement->getElementHtml();
+
+ $this->assertContains('media/' . $filePath, $html);
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/invalidMenuXmlArray.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/invalidMenuXmlArray.php
index 5ce31bbd979ee..a187bc629dcbb 100644
--- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/invalidMenuXmlArray.php
+++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/invalidMenuXmlArray.php
@@ -209,7 +209,7 @@
'resource="test_Value::value"/>',
[
"Element 'add', attribute 'resource': [facet 'pattern'] The value 'test_Value::value' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'add', attribute 'resource': 'test_Value::value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -220,7 +220,7 @@
'resource="Test_value::value"/>',
[
"Element 'add', attribute 'resource': [facet 'pattern'] The value 'Test_value::value' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'add', attribute 'resource': 'Test_value::value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -231,7 +231,7 @@
'resource="M#$%23_value::value"/>',
[
"Element 'add', attribute 'resource': [facet 'pattern'] The value 'M#$%23_value::value' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'add', attribute 'resource': 'M#$%23_value::value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -242,7 +242,7 @@
'resource="_value::value"/>',
[
"Element 'add', attribute 'resource': [facet 'pattern'] The value '_value::value' is not accepted by " .
- "the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'add', attribute 'resource': '_value::value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -253,7 +253,7 @@
'',
[
"Element 'add', attribute 'resource': [facet 'pattern'] The value 'Magento_::value' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'add', attribute 'resource': 'Magento_::value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -264,7 +264,7 @@
'resource="Test_Value:value"/>',
[
"Element 'add', attribute 'resource': [facet 'pattern'] The value 'Test_Value:value' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'add', attribute 'resource': 'Test_Value:value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -275,7 +275,7 @@
'resource="Test_Value::"/>',
[
"Element 'add', attribute 'resource': [facet 'pattern'] The value 'Test_Value::' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'add', attribute 'resource': 'Test_Value::' " .
"is not a valid value of the atomic type 'typeResource'."
],
@@ -608,7 +608,7 @@
'resource="test_Value::value"/>',
[
"Element 'update', attribute 'resource': [facet 'pattern'] The value 'test_Value::value' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'update', attribute 'resource': 'test_Value::value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -618,7 +618,7 @@
'resource="Test_value::value"/>',
[
"Element 'update', attribute 'resource': [facet 'pattern'] The value 'Test_value::value' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'update', attribute 'resource': 'Test_value::value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -628,7 +628,7 @@
'resource="M#$%23_value::value"/>',
[
"Element 'update', attribute 'resource': [facet 'pattern'] The value 'M#$%23_value::value' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'update', attribute 'resource': 'M#$%23_value::value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -638,7 +638,7 @@
'resource="_value::value"/>',
[
"Element 'update', attribute 'resource': [facet 'pattern'] The value '_value::value' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'update', attribute 'resource': '_value::value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -648,7 +648,7 @@
'resource="Magento_::value"/>',
[
"Element 'update', attribute 'resource': [facet 'pattern'] The value 'Magento_::value' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'update', attribute 'resource': 'Magento_::value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -658,7 +658,7 @@
'resource="Test_Value:value"/>',
[
"Element 'update', attribute 'resource': [facet 'pattern'] The value 'Test_Value:value' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'update', attribute 'resource': 'Test_Value:value' is not a valid value of the atomic " .
"type 'typeResource'."
],
@@ -668,7 +668,7 @@
'resource="Test_Value::"/>',
[
"Element 'update', attribute 'resource': [facet 'pattern'] The value 'Test_Value::' is not " .
- "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
+ "accepted by the pattern '[A-Z]+[A-Za-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.",
"Element 'update', attribute 'resource': 'Test_Value::' is not a valid value of the atomic " .
"type 'typeResource'."
],
diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/valid_menu.xml b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/valid_menu.xml
index f579f7d1fed23..a0358a1dfbf89 100644
--- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/valid_menu.xml
+++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/valid_menu.xml
@@ -7,7 +7,7 @@
-->
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php
index a48451fca5acd..aae483343d502 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php
@@ -9,6 +9,8 @@
*/
namespace Magento\Framework\Data\Form\Element;
+use Magento\Framework\UrlInterface;
+
class ImageTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -16,6 +18,11 @@ class ImageTest extends \PHPUnit_Framework_TestCase
*/
protected $_objectManagerMock;
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $urlBuilder;
+
/**
* @var \Magento\Framework\Data\Form\Element\Image
*/
@@ -32,12 +39,12 @@ protected function setUp()
false
);
$escaperMock = $this->getMock('\Magento\Framework\Escaper', [], [], '', false);
- $urlBuilderMock = $this->getMock('\Magento\Framework\Url', [], [], '', false);
+ $this->urlBuilder = $this->getMock('\Magento\Framework\Url', [], [], '', false);
$this->_image = new \Magento\Framework\Data\Form\Element\Image(
$factoryMock,
$collectionFactoryMock,
$escaperMock,
- $urlBuilderMock
+ $this->urlBuilder
);
$formMock = new \Magento\Framework\Object();
$formMock->getHtmlIdPrefix('id_prefix');
@@ -81,12 +88,16 @@ public function testGetElementHtmlWithoutValue()
public function testGetElementHtmlWithValue()
{
$this->_image->setValue('test_value');
+ $this->urlBuilder->expects($this->once())
+ ->method('getBaseUrl')
+ ->with(['_type' => UrlInterface::URL_TYPE_MEDIA])
+ ->willReturn('http://localhost/media/');
$html = $this->_image->getElementHtml();
$this->assertContains('class="input-file"', $html);
$this->assertContains('assertContains('type="file"', $html);
$this->assertContains('value="test_value"', $html);
- $this->assertContains('assertContains('assertContains('_urlBuilder = $urlBuilder;
@@ -50,7 +52,7 @@ public function getElementHtml()
$url = $this->_getUrl();
if (!preg_match("/^http\:\/\/|https\:\/\//", $url)) {
- $url = $this->_urlBuilder->getBaseUrl('media') . $url;
+ $url = $this->_urlBuilder->getBaseUrl(['_type' => UrlInterface::URL_TYPE_MEDIA]) . $url;
}
$html = '