ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
AdvancedValueBinderTest Class Reference
+ Inheritance diagram for AdvancedValueBinderTest:
+ Collaboration diagram for AdvancedValueBinderTest:

Public Member Functions

 setUp ()
 
 provider ()
 
 testCurrency ($value, $valueBinded, $format, $thousandsSeparator, $decimalSeparator, $currencyCode)
 @dataProvider provider More...
 

Detailed Description

Definition at line 3 of file AdvancedValueBinderTest.php.

Member Function Documentation

◆ provider()

AdvancedValueBinderTest::provider ( )

Definition at line 13 of file AdvancedValueBinderTest.php.

14 {
15 if (!class_exists('PHPExcel_Style_NumberFormat')) {
16 $this->setUp();
17 }
19 $currencyEURO = str_replace('$', '€', PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
20
21 return array(
22 array('10%', 0.1, PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00, ',', '.', '$'),
23 array('$10.11', 10.11, $currencyUSD, ',', '.', '$'),
24 array('$1,010.12', 1010.12, $currencyUSD, ',', '.', '$'),
25 array('$20,20', 20.2, $currencyUSD, '.', ',', '$'),
26 array('$2.020,20', 2020.2, $currencyUSD, '.', ',', '$'),
27 array('€2.020,20', 2020.2, $currencyEURO, '.', ',', '€'),
28 array('€ 2.020,20', 2020.2, $currencyEURO, '.', ',', '€'),
29 array('€2,020.22', 2020.22, $currencyEURO, ',', '.', '€'),
30 );
31 }

References PHPExcel_Style_NumberFormat\FORMAT_CURRENCY_USD_SIMPLE, PHPExcel_Style_NumberFormat\FORMAT_PERCENTAGE_00, and setUp().

+ Here is the call graph for this function:

◆ setUp()

AdvancedValueBinderTest::setUp ( )

Definition at line 5 of file AdvancedValueBinderTest.php.

6 {
7 if (!defined('PHPEXCEL_ROOT')) {
8 define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
9 }
10 require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
11 }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

References defined.

Referenced by provider().

+ Here is the caller graph for this function:

◆ testCurrency()

AdvancedValueBinderTest::testCurrency (   $value,
  $valueBinded,
  $format,
  $thousandsSeparator,
  $decimalSeparator,
  $currencyCode 
)

@dataProvider provider

Definition at line 36 of file AdvancedValueBinderTest.php.

37 {
38 $sheet = $this->getMock(
39 'PHPExcel_Worksheet',
40 array('getStyle', 'getNumberFormat', 'setFormatCode','getCellCacheController')
41 );
42 $cache = $this->getMockBuilder('PHPExcel_CachedObjectStorage_Memory')
43 ->disableOriginalConstructor()
44 ->getMock();
45 $cache->expects($this->any())
46 ->method('getParent')
47 ->will($this->returnValue($sheet));
48
49 $sheet->expects($this->once())
50 ->method('getStyle')
51 ->will($this->returnSelf());
52 $sheet->expects($this->once())
53 ->method('getNumberFormat')
54 ->will($this->returnSelf());
55 $sheet->expects($this->once())
56 ->method('setFormatCode')
57 ->with($format)
58 ->will($this->returnSelf());
59 $sheet->expects($this->any())
60 ->method('getCellCacheController')
61 ->will($this->returnValue($cache));
62
66
67 $cell = new PHPExcel_Cell(NULL, PHPExcel_Cell_DataType::TYPE_STRING, $sheet);
68
70 $binder->bindValue($cell, $value);
71 $this->assertEquals($valueBinded, $cell->getValue());
72 }
static setDecimalSeparator($pValue='.')
Set the decimal separator.
Definition: String.php:708
static setCurrencyCode($pValue='$')
Set the currency code.
Definition: String.php:772
static setThousandsSeparator($pValue=',')
Set the thousands separator.
Definition: String.php:740
$format
Definition: metadata.php:141

References $format, PHPExcel_Shared_String\setCurrencyCode(), PHPExcel_Shared_String\setDecimalSeparator(), PHPExcel_Shared_String\setThousandsSeparator(), and PHPExcel_Cell_DataType\TYPE_STRING.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: