-
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.
MAGETWO-33727: Wrong parameter for getting base url for 'media' path …
…in "Image" form element. #1025 - Import UrlInterface to short line to under 120 characters - Add integration test to catch regression - Modify unit test to catch regression
- Loading branch information
Showing
3 changed files
with
56 additions
and
7 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/ImageTest.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,36 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
/** | ||
* Tests for \Magento\Framework\Data\Form\Element\Image | ||
*/ | ||
namespace Magento\Framework\Data\Form\Element; | ||
|
||
class ImageTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var \Magento\Framework\Data\Form\Element\Image | ||
*/ | ||
protected $imageElement; | ||
|
||
protected function setUp() | ||
{ | ||
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); | ||
/** @var $elementFactory \Magento\Framework\Data\Form\ElementFactory */ | ||
$elementFactory = $objectManager->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); | ||
} | ||
} |
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