You are here

function DecimalFormatterTest::testClone in Currency 7.2

Test cloning.

File

currency/vendor/bartfeenstra/cldr/src/BartFeenstra/Tests/CLDR/DecimalFormatterTest.php, line 22
Contains class \BartFeenstra\Tests\CLDR\DecimalFormatterTest.

Class

DecimalFormatterTest
Tests \BartFeenstra\CLDR\DecimalFormatter

Namespace

BartFeenstra\Tests\CLDR

Code

function testClone() {
  $formatter = new TestDecimalFormatter('#,##0.00;#,##0.00-', array(
    DecimalFormatter::SYMBOL_SPECIAL_GROUPING_SEPARATOR => '.',
  ));
  $formatter_clone = clone $formatter;
  $symbols = $formatter
    ->get('symbols');
  $symbols[DecimalFormatter::POSITIVE][DecimalFormatter::MAJOR][0]->symbol = 'AAA';
  $symbols_clone = $formatter_clone
    ->get('symbols');
  $this
    ->assertNotSame($symbols[DecimalFormatter::POSITIVE][DecimalFormatter::MAJOR][0]->symbol, $symbols_clone[DecimalFormatter::POSITIVE][DecimalFormatter::MAJOR][0]->symbol, 'When a DecimalFormatter is cloned, so are its NumberPatternSymbol elements.');
}