-
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-32756: [GITHUB] Access to the currency code and symbol from p…
…rice templates #941
- Loading branch information
Yu Tang
committed
Apr 28, 2015
1 parent
786ed7b
commit 5bd0fe3
Showing
8 changed files
with
116 additions
and
0 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
55 changes: 55 additions & 0 deletions
55
app/code/Magento/Directory/Test/Unit/Model/CurrencyTest.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,55 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Directory\Test\Unit\Model; | ||
|
||
use Magento\Directory\Model\Currency; | ||
|
||
class CurrencyTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var Currency | ||
*/ | ||
protected $currency; | ||
|
||
protected $currencyCode = 'USD'; | ||
|
||
/** | ||
* @var \Magento\Framework\Locale\CurrencyInterface|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
protected $localeCurrencyMock; | ||
|
||
public function setUp() | ||
{ | ||
$this->localeCurrencyMock = $this->getMock('\Magento\Framework\Locale\CurrencyInterface'); | ||
|
||
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); | ||
$this->currency = $objectManager->getObject('Magento\Directory\Model\Currency', [ | ||
'localeCurrency' => $this->localeCurrencyMock, | ||
'data' => [ | ||
'currency_code' => $this->currencyCode, | ||
] | ||
]); | ||
} | ||
|
||
public function testGetCurrencySymbol() | ||
{ | ||
$currencySymbol = '$'; | ||
|
||
$currencyMock = $this->getMockBuilder('\Magento\Framework\Currency') | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$currencyMock->expects($this->once()) | ||
->method('getSymbol') | ||
->willReturn($currencySymbol); | ||
|
||
$this->localeCurrencyMock->expects($this->once()) | ||
->method('getCurrency') | ||
->with($this->currencyCode) | ||
->willReturn($currencyMock); | ||
$this->assertEquals($currencySymbol, $this->currency->getCurrencySymbol()); | ||
} | ||
} |
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