-
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 pull request #574 from magento-tango/happy_merchant
[Tango] S59 - Merchant Beta Bug Fixes
- Loading branch information
Showing
9 changed files
with
402 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Widget\Model\Template; | ||
|
||
class FilterEmulate extends Filter | ||
{ | ||
/** | ||
* Generate widget with emulation frontend area | ||
* | ||
* @param string[] $construction | ||
* @return string | ||
*/ | ||
public function widgetDirective($construction) | ||
{ | ||
return $this->_appState->emulateAreaCode('frontend', [$this, 'generateWidget'], [$construction]); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
app/code/Magento/Widget/Test/Unit/Model/Template/FilterEmulateTest.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,59 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Widget\Test\Unit\Model\Template; | ||
|
||
use \Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; | ||
|
||
class FilterEmulateTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var ObjectManagerHelper | ||
*/ | ||
protected $objectManagerHelper; | ||
|
||
/** | ||
* @var \Magento\Widget\Model\Template\FilterEmulate | ||
*/ | ||
protected $filterEmulate; | ||
|
||
/** | ||
* @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
protected $appStateMock; | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->objectManagerHelper = new ObjectManagerHelper($this); | ||
$this->appStateMock = $this->getMock('Magento\Framework\App\State', [], [], '', false); | ||
|
||
$this->filterEmulate = $this->objectManagerHelper->getObject( | ||
'Magento\Widget\Model\Template\FilterEmulate', | ||
['appState' => $this->appStateMock] | ||
); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testWidgetDirective() | ||
{ | ||
$result = 'some text'; | ||
$construction = [ | ||
'{{widget type="Widget\\Link" anchor_text="Test" template="block.phtml" id_path="p/1"}}', | ||
'widget', | ||
' type="" anchor_text="Test" template="block.phtml" id_path="p/1"' | ||
]; | ||
|
||
$this->appStateMock->expects($this->once()) | ||
->method('emulateAreaCode') | ||
->with('frontend', [$this->filterEmulate, 'generateWidget'], [$construction]) | ||
->willReturn($result); | ||
$this->assertSame($result, $this->filterEmulate->widgetDirective($construction)); | ||
} | ||
} |
Oops, something went wrong.