PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 2.2.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v2.2.0
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / phpoffice / phpexcel / unitTests / Classes / PHPExcel / Cell / DefaultValueBinderTest.php

DefaultValueBinderTest.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 2.2.0, at vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Cell/DefaultValueBinderTest.php

86 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 require_once 'testDataFileIterator.php';
4
5 class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
6 {
7 protected $cellStub;
8
9 public function setUp()
10 {
11 if (!defined('PHPEXCEL_ROOT'))
12 {
13 define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
14 }
15 require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
16 }
17
18 protected function createCellStub()
19 {
20 // Create a stub for the Cell class.
21 $this->cellStub = $this->getMockBuilder('PHPExcel_Cell')
22 ->disableOriginalConstructor()
23 ->getMock();
24 // Configure the stub.
25 $this->cellStub->expects($this->any())
26 ->method('setValueExplicit')
27 ->will($this->returnValue(true));
28
29 }
30
31 /**
32 * @dataProvider binderProvider
33 */
34 public function testBindValue($value)
35 {
36 $this->createCellStub();
37 $binder = new PHPExcel_Cell_DefaultValueBinder();
38 $result = $binder->bindValue($this->cellStub, $value);
39 $this->assertTrue($result);
40 }
41
42 public function binderProvider()
43 {
44 return array(
45 array(null),
46 array(''),
47 array('ABC'),
48 array('=SUM(A1:B2)'),
49 array(true),
50 array(false),
51 array(123),
52 array(-123.456),
53 array('123'),
54 array('-123.456'),
55 array('#REF!'),
56 array(new DateTime()),
57 );
58 }
59
60 /**
61 * @dataProvider providerDataTypeForValue
62 */
63 public function testDataTypeForValue()
64 {
65 $args = func_get_args();
66 $expectedResult = array_pop($args);
67 $result = call_user_func_array(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $args);
68 $this->assertEquals($expectedResult, $result);
69 }
70
71 public function providerDataTypeForValue()
72 {
73 return new testDataFileIterator('rawTestData/Cell/DefaultValueBinder.data');
74 }
75
76 public function testDataTypeForRichTextObject()
77 {
78 $objRichText = new PHPExcel_RichText();
79 $objRichText->createText('Hello World');
80
81 $expectedResult = PHPExcel_Cell_DataType::TYPE_INLINE;
82 $result = call_user_func(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $objRichText);
83 $this->assertEquals($expectedResult, $result);
84 }
85 }
86