Unit tests for default value binder

This commit is contained in:
MarkBaker 2015-03-27 21:28:26 +00:00
parent c5a117c82a
commit d9cda3f287
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,33 @@
<?php
require_once 'testDataFileIterator.php';
class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* @dataProvider providerDataTypeForValue
*/
public function testDataTypeForValue()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerDataTypeForValue()
{
return new testDataFileIterator('rawTestData/Cell/DefaultValueBinder.data');
}
}

View File

@ -0,0 +1,19 @@
NULL, "null"
, "null"
"#NULL!", "e"
FALSE, "b"
TRUE, "b"
"FALSE", "s"
"TRUE", "s"
"", "s"
"ABC", "s"
"123", "n"
123, "n"
0.123, "n"
"-123", "n"
"1.23E4", "n"
"-1.23E4", "n"
"1.23E-4", "n"
"000123", "s"
"=123", "f"
"#DIV/0!", "e"