CurrencyTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Test\Unit;
  7. use Magento\Framework\Currency;
  8. /**
  9. * Test for Magento\Framework\Currency
  10. */
  11. class CurrencyTest extends \PHPUnit\Framework\TestCase
  12. {
  13. public function testConstruct()
  14. {
  15. $frontendCache = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
  16. $lowLevelFrontend = $this->createMock(\Zend_Cache_Core::class);
  17. /** @var \Magento\Framework\App\CacheInterface|\PHPUnit_Framework_MockObject_MockObject $appCache */
  18. $appCache = $this->createMock(\Magento\Framework\App\CacheInterface::class);
  19. $frontendCache->expects($this->once())->method('getLowLevelFrontend')->willReturn($lowLevelFrontend);
  20. $appCache->expects($this->once())
  21. ->method('getFrontend')
  22. ->willReturn($frontendCache);
  23. // Create new currency object
  24. $currency = new Currency($appCache, null, 'en_US');
  25. $this->assertEquals($lowLevelFrontend, $currency->getCache());
  26. $this->assertEquals('USD', $currency->getShortName());
  27. }
  28. }