update 1.0.8.0

Commits for version update
This commit is contained in:
Manish Verma
2016-10-17 12:02:27 +05:30
parent dec927987b
commit 76e85db070
9674 changed files with 495757 additions and 58922 deletions

View File

@@ -0,0 +1,57 @@
<?php
require_once 'testDataFileIterator.php';
class CodePageTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* @dataProvider providerCodePage
*/
public function testCodePageNumberToName()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_CodePage','NumberToName'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerCodePage()
{
return new testDataFileIterator('rawTestData/Shared/CodePage.data');
}
public function testNumberToNameWithInvalidCodePage()
{
$invalidCodePage = 12345;
try {
$result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'),$invalidCodePage);
} catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Unknown codepage: 12345');
return;
}
$this->fail('An expected exception has not been raised.');
}
public function testNumberToNameWithUnsupportedCodePage()
{
$unsupportedCodePage = 720;
try {
$result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'),$unsupportedCodePage);
} catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Code page 720 not supported.');
return;
}
$this->fail('An expected exception has not been raised.');
}
}

View File

@@ -0,0 +1,188 @@
<?php
require_once 'testDataFileIterator.php';
class DateTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
public function testSetExcelCalendar()
{
$calendarValues = array(
PHPExcel_Shared_Date::CALENDAR_MAC_1904,
PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900,
);
foreach($calendarValues as $calendarValue) {
$result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'),$calendarValue);
$this->assertTrue($result);
}
}
public function testSetExcelCalendarWithInvalidValue()
{
$unsupportedCalendar = '2012';
$result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'),$unsupportedCalendar);
$this->assertFalse($result);
}
/**
* @dataProvider providerDateTimeExcelToPHP1900
*/
public function testDateTimeExcelToPHP1900()
{
$result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900
);
$args = func_get_args();
$expectedResult = array_pop($args);
if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0);
}
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerDateTimeExcelToPHP1900()
{
return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900.data');
}
/**
* @dataProvider providerDateTimePHPToExcel1900
*/
public function testDateTimePHPToExcel1900()
{
$result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900
);
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5);
}
public function providerDateTimePHPToExcel1900()
{
return new testDataFileIterator('rawTestData/Shared/DateTimePHPToExcel1900.data');
}
/**
* @dataProvider providerDateTimeFormattedPHPToExcel1900
*/
public function testDateTimeFormattedPHPToExcel1900()
{
$result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900
);
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','FormattedPHPToExcel'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5);
}
public function providerDateTimeFormattedPHPToExcel1900()
{
return new testDataFileIterator('rawTestData/Shared/DateTimeFormattedPHPToExcel1900.data');
}
/**
* @dataProvider providerDateTimeExcelToPHP1904
*/
public function testDateTimeExcelToPHP1904()
{
$result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_MAC_1904
);
$args = func_get_args();
$expectedResult = array_pop($args);
if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0);
}
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerDateTimeExcelToPHP1904()
{
return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1904.data');
}
/**
* @dataProvider providerDateTimePHPToExcel1904
*/
public function testDateTimePHPToExcel1904()
{
$result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_MAC_1904
);
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5);
}
public function providerDateTimePHPToExcel1904()
{
return new testDataFileIterator('rawTestData/Shared/DateTimePHPToExcel1904.data');
}
/**
* @dataProvider providerIsDateTimeFormatCode
*/
public function testIsDateTimeFormatCode()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','isDateTimeFormatCode'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerIsDateTimeFormatCode()
{
return new testDataFileIterator('rawTestData/Shared/DateTimeFormatCodes.data');
}
/**
* @dataProvider providerDateTimeExcelToPHP1900Timezone
*/
public function testDateTimeExcelToPHP1900Timezone()
{
$result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900
);
$args = func_get_args();
$expectedResult = array_pop($args);
if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0);
}
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerDateTimeExcelToPHP1900Timezone()
{
return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900Timezone.data');
}
}

View File

@@ -0,0 +1,39 @@
<?php
require_once 'testDataFileIterator.php';
class FileTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
public function testGetUseUploadTempDirectory()
{
$expectedResult = FALSE;
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
$this->assertEquals($expectedResult, $result);
}
public function testSetUseUploadTempDirectory()
{
$useUploadTempDirectoryValues = array(
TRUE,
FALSE,
);
foreach($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {
call_user_func(array('PHPExcel_Shared_File','setUseUploadTempDirectory'),$useUploadTempDirectoryValue);
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
$this->assertEquals($useUploadTempDirectoryValue, $result);
}
}
}

View File

@@ -0,0 +1,94 @@
<?php
require_once 'testDataFileIterator.php';
class FontTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
public function testGetAutoSizeMethod()
{
$expectedResult = PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX;
$result = call_user_func(array('PHPExcel_Shared_Font','getAutoSizeMethod'));
$this->assertEquals($expectedResult, $result);
}
public function testSetAutoSizeMethod()
{
$autosizeMethodValues = array(
PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT,
PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX,
);
foreach($autosizeMethodValues as $autosizeMethodValue) {
$result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'),$autosizeMethodValue);
$this->assertTrue($result);
}
}
public function testSetAutoSizeMethodWithInvalidValue()
{
$unsupportedAutosizeMethod = 'guess';
$result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'),$unsupportedAutosizeMethod);
$this->assertFalse($result);
}
/**
* @dataProvider providerFontSizeToPixels
*/
public function testFontSizeToPixels()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','fontSizeToPixels'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerFontSizeToPixels()
{
return new testDataFileIterator('rawTestData/Shared/FontSizeToPixels.data');
}
/**
* @dataProvider providerInchSizeToPixels
*/
public function testInchSizeToPixels()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','inchSizeToPixels'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerInchSizeToPixels()
{
return new testDataFileIterator('rawTestData/Shared/InchSizeToPixels.data');
}
/**
* @dataProvider providerCentimeterSizeToPixels
*/
public function testCentimeterSizeToPixels()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','centimeterSizeToPixels'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerCentimeterSizeToPixels()
{
return new testDataFileIterator('rawTestData/Shared/CentimeterSizeToPixels.data');
}
}

View File

@@ -0,0 +1,33 @@
<?php
require_once 'testDataFileIterator.php';
class PasswordHasherTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* @dataProvider providerHashPassword
*/
public function testHashPassword()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_PasswordHasher','hashPassword'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerHashPassword()
{
return new testDataFileIterator('rawTestData/Shared/PasswordHashes.data');
}
}

View File

@@ -0,0 +1,83 @@
<?php
require_once 'testDataFileIterator.php';
class StringTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
public function testGetIsMbStringEnabled()
{
$result = call_user_func(array('PHPExcel_Shared_String','getIsMbstringEnabled'));
$this->assertTrue($result);
}
public function testGetIsIconvEnabled()
{
$result = call_user_func(array('PHPExcel_Shared_String','getIsIconvEnabled'));
$this->assertTrue($result);
}
public function testGetDecimalSeparator()
{
$localeconv = localeconv();
$expectedResult = (!empty($localeconv['decimal_point'])) ? $localeconv['decimal_point'] : ',';
$result = call_user_func(array('PHPExcel_Shared_String','getDecimalSeparator'));
$this->assertEquals($expectedResult, $result);
}
public function testSetDecimalSeparator()
{
$expectedResult = ',';
$result = call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),$expectedResult);
$result = call_user_func(array('PHPExcel_Shared_String','getDecimalSeparator'));
$this->assertEquals($expectedResult, $result);
}
public function testGetThousandsSeparator()
{
$localeconv = localeconv();
$expectedResult = (!empty($localeconv['thousands_sep'])) ? $localeconv['thousands_sep'] : ',';
$result = call_user_func(array('PHPExcel_Shared_String','getThousandsSeparator'));
$this->assertEquals($expectedResult, $result);
}
public function testSetThousandsSeparator()
{
$expectedResult = ' ';
$result = call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),$expectedResult);
$result = call_user_func(array('PHPExcel_Shared_String','getThousandsSeparator'));
$this->assertEquals($expectedResult, $result);
}
public function testGetCurrencyCode()
{
$localeconv = localeconv();
$expectedResult = (!empty($localeconv['currency_symbol'])) ? $localeconv['currency_symbol'] : '$';
$result = call_user_func(array('PHPExcel_Shared_String','getCurrencyCode'));
$this->assertEquals($expectedResult, $result);
}
public function testSetCurrencyCode()
{
$expectedResult = '£';
$result = call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),$expectedResult);
$result = call_user_func(array('PHPExcel_Shared_String','getCurrencyCode'));
$this->assertEquals($expectedResult, $result);
}
}

View File

@@ -0,0 +1,39 @@
<?php
class TimeZoneTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
public function testSetTimezone()
{
$timezoneValues = array(
'Europe/Prague',
'Asia/Tokyo',
'America/Indiana/Indianapolis',
'Pacific/Honolulu',
'Atlantic/St_Helena',
);
foreach($timezoneValues as $timezoneValue) {
$result = call_user_func(array('PHPExcel_Shared_TimeZone','setTimezone'),$timezoneValue);
$this->assertTrue($result);
}
}
public function testSetTimezoneWithInvalidValue()
{
$unsupportedTimezone = 'Etc/GMT+10';
$result = call_user_func(array('PHPExcel_Shared_TimeZone','setTimezone'),$unsupportedTimezone);
$this->assertFalse($result);
}
}