forked from PrestaShop/PrestaShop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started working on Locale (interface, entity, test)
- Loading branch information
1 parent
4b3a8f4
commit ed1d40b
Showing
3 changed files
with
163 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
/** | ||
* 2007-2018 PrestaShop | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright 2007-2018 PrestaShop SA | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
* International Registered Trademark & Property of PrestaShop SA | ||
*/ | ||
|
||
namespace PrestaShop\PrestaShop\Core\Localization; | ||
|
||
use PrestaShop\PrestaShop\Core\Localization\Currency\CurrencyCollection; | ||
use PrestaShop\PrestaShop\Core\Localization\Specification\Number as NumberSpecification; | ||
use PrestaShop\PrestaShop\Core\Localization\Specification\Price as PriceSpecification; | ||
|
||
class Locale implements LocaleInterface | ||
{ | ||
/** | ||
* @var NumberSpecification | ||
*/ | ||
protected $numberSpecification; | ||
|
||
/** | ||
* @var CurrencyCollection | ||
*/ | ||
protected $currencies; | ||
|
||
/** | ||
* Get price specification for a given currency | ||
* | ||
* @param string $currencyCode | ||
* The currency's ISO 4217 code | ||
* | ||
* @return PriceSpecification | ||
* A Price specification | ||
*/ | ||
protected function getPriceSpecification($currencyCode) | ||
{ | ||
$currency = $this->currencies->get($currencyCode); | ||
|
||
// $priceSpecification = new Price( | ||
// $positivePattern, | ||
// $negativePattern, | ||
// $symbols, | ||
// $maxFractionDigits, | ||
// $minFractionDigits, | ||
// $groupingUsed, | ||
// $primaryGroupSize, | ||
// $secondaryGroupSize, | ||
// $currencyDisplay, | ||
// $currency->getSymbol($this->code), | ||
// $currency->getIsoCode() | ||
// ); | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
/** | ||
* 2007-2018 PrestaShop | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright 2007-2018 PrestaShop SA | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
* International Registered Trademark & Property of PrestaShop SA | ||
*/ | ||
|
||
namespace PrestaShop\PrestaShop\Core\Localization; | ||
|
||
/** | ||
* Locale entity interface | ||
* | ||
* Describes the behavior of locale classes | ||
*/ | ||
interface LocaleInterface | ||
{ | ||
|
||
} |
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,54 @@ | ||
<?php | ||
/** | ||
* 2007-2018 PrestaShop | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright 2007-2018 PrestaShop SA | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
* International Registered Trademark & Property of PrestaShop SA | ||
*/ | ||
|
||
namespace Tests\Unit\Core\Localization; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use PrestaShop\PrestaShop\Core\Localization\Locale; | ||
|
||
class LocaleTest extends TestCase | ||
{ | ||
protected $cldrLocale; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
protected function setUp() | ||
{ | ||
// $this->locale was already taken by TestCase | ||
$this->cldrLocale = new Locale(); | ||
} | ||
|
||
public function testFormatNumber($number) | ||
{ | ||
$this->markTestIncomplete('This test is not implemented yet'); | ||
} | ||
|
||
public function testFormatPrice($number, $currencyCode) | ||
{ | ||
$this->markTestIncomplete('This test is not implemented yet'); | ||
} | ||
} |