PSR2 Fixes
This commit is contained in:
parent
1d842ed218
commit
09352e3e80
|
@ -387,7 +387,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getContiguous(){
|
||||
public function getContiguous()
|
||||
{
|
||||
return $this->_contiguous;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,11 +257,11 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
|||
*/
|
||||
protected static function _pixel2WidthUnits($pxs)
|
||||
{
|
||||
$UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219);
|
||||
$UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219);
|
||||
|
||||
$widthUnits = 256 * ($pxs / 7);
|
||||
$widthUnits += $UNIT_OFFSET_MAP[($pxs % 7)];
|
||||
return $widthUnits;
|
||||
$widthUnits = 256 * ($pxs / 7);
|
||||
$widthUnits += $UNIT_OFFSET_MAP[($pxs % 7)];
|
||||
return $widthUnits;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -998,16 +998,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|||
// Standard filters are always an OR join, so no join rule needs to be set
|
||||
// Entries can be either filter elements
|
||||
foreach ($filters->filter as $filterRule) {
|
||||
$column->createRule()->setRule(
|
||||
null,// Operator is undefined, but always treated as EQUAL
|
||||
(string) $filterRule["val"]
|
||||
)
|
||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
|
||||
// Operator is undefined, but always treated as EQUAL
|
||||
$column->createRule()->setRule(null, (string) $filterRule["val"])->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
|
||||
}
|
||||
// Or Date Group elements
|
||||
foreach ($filters->dateGroupItem as $dateGroupItem) {
|
||||
$column->createRule()->setRule(
|
||||
null,// Operator is undefined, but always treated as EQUAL
|
||||
// Operator is undefined, but always treated as EQUAL
|
||||
null,
|
||||
array(
|
||||
'year' => (string) $dateGroupItem["year"],
|
||||
'month' => (string) $dateGroupItem["month"],
|
||||
|
@ -1044,7 +1042,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|||
// We should only ever have one dynamic filter
|
||||
foreach ($filterColumn->dynamicFilter as $filterRule) {
|
||||
$column->createRule()->setRule(
|
||||
null,// Operator is undefined, but always treated as EQUAL
|
||||
// Operator is undefined, but always treated as EQUAL
|
||||
null,
|
||||
(string) $filterRule["val"],
|
||||
(string) $filterRule["type"]
|
||||
)
|
||||
|
|
|
@ -81,21 +81,21 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||
foreach ($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
switch ($chartDetailKey) {
|
||||
case "layout":
|
||||
$plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'plotArea');
|
||||
$plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta, 'plotArea');
|
||||
break;
|
||||
case "catAx":
|
||||
if (isset($chartDetail->title)) {
|
||||
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat');
|
||||
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
|
||||
}
|
||||
break;
|
||||
case "dateAx":
|
||||
if (isset($chartDetail->title)) {
|
||||
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat');
|
||||
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
|
||||
}
|
||||
break;
|
||||
case "valAx":
|
||||
if (isset($chartDetail->title)) {
|
||||
$YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat');
|
||||
$YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
|
||||
}
|
||||
break;
|
||||
case "barChart":
|
||||
|
@ -173,7 +173,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||
$dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string');
|
||||
break;
|
||||
case "title":
|
||||
$title = self::_chartTitle($chartDetails, $namespacesChartMeta,'title');
|
||||
$title = self::_chartTitle($chartDetails, $namespacesChartMeta, 'title');
|
||||
break;
|
||||
case "legend":
|
||||
$legendPos = 'r';
|
||||
|
@ -188,7 +188,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||
$legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean');
|
||||
break;
|
||||
case "layout":
|
||||
$legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'legend');
|
||||
$legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta, 'legend');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||
}
|
||||
$layout = array();
|
||||
foreach ($details as $detailKey => $detail) {
|
||||
// echo $detailKey,' => ',self::_getAttribute($detail, 'val', 'string'),PHP_EOL;
|
||||
// echo $detailKey, ' => ',self::_getAttribute($detail, 'val', 'string'),PHP_EOL;
|
||||
$layout[$detailKey] = self::_getAttribute($detail, 'val', 'string');
|
||||
}
|
||||
return new PHPExcel_Chart_Layout($layout);
|
||||
|
@ -300,7 +300,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||
{
|
||||
if (isset($seriesDetail->strRef)) {
|
||||
$seriesSource = (string) $seriesDetail->strRef->f;
|
||||
$seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']),'s');
|
||||
$seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']), 's');
|
||||
|
||||
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
|
||||
} elseif (isset($seriesDetail->numRef)) {
|
||||
|
@ -310,13 +310,13 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||
return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
|
||||
} elseif (isset($seriesDetail->multiLvlStrRef)) {
|
||||
$seriesSource = (string) $seriesDetail->multiLvlStrRef->f;
|
||||
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']),'s');
|
||||
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']), 's');
|
||||
$seriesData['pointCount'] = count($seriesData['dataValues']);
|
||||
|
||||
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
|
||||
} elseif (isset($seriesDetail->multiLvlNumRef)) {
|
||||
$seriesSource = (string) $seriesDetail->multiLvlNumRef->f;
|
||||
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']),'s');
|
||||
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']), 's');
|
||||
$seriesData['pointCount'] = count($seriesData['dataValues']);
|
||||
|
||||
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
|
||||
|
@ -400,7 +400,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||
|
||||
foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
|
||||
if (isset($titleDetailElement->t)) {
|
||||
$objText = $value->createTextRun( (string) $titleDetailElement->t );
|
||||
$objText = $value->createTextRun((string) $titleDetailElement->t);
|
||||
}
|
||||
if (isset($titleDetailElement->rPr)) {
|
||||
if (isset($titleDetailElement->rPr->rFont["val"])) {
|
||||
|
@ -414,7 +414,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||
|
||||
$fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string'));
|
||||
if (!is_null($fontColor)) {
|
||||
$objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($fontColor) ) );
|
||||
$objText->getFont()->setColor(new PHPExcel_Style_Color(self::_readColor($fontColor)));
|
||||
}
|
||||
|
||||
$bold = self::_getAttribute($titleDetailElement->rPr, 'b', 'boolean');
|
||||
|
@ -495,25 +495,25 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||
{
|
||||
foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
|
||||
switch ($plotAttributeKey) {
|
||||
case 'showLegendKey' :
|
||||
case 'showLegendKey':
|
||||
$plotArea->setShowLegendKey($plotAttributeValue);
|
||||
break;
|
||||
case 'showVal' :
|
||||
case 'showVal':
|
||||
$plotArea->setShowVal($plotAttributeValue);
|
||||
break;
|
||||
case 'showCatName' :
|
||||
case 'showCatName':
|
||||
$plotArea->setShowCatName($plotAttributeValue);
|
||||
break;
|
||||
case 'showSerName' :
|
||||
case 'showSerName':
|
||||
$plotArea->setShowSerName($plotAttributeValue);
|
||||
break;
|
||||
case 'showPercent' :
|
||||
case 'showPercent':
|
||||
$plotArea->setShowPercent($plotAttributeValue);
|
||||
break;
|
||||
case 'showBubbleSize' :
|
||||
case 'showBubbleSize':
|
||||
$plotArea->setShowBubbleSize($plotAttributeValue);
|
||||
break;
|
||||
case 'showLeaderLines' :
|
||||
case 'showLeaderLines':
|
||||
$plotArea->setShowLeaderLines($plotAttributeValue);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -559,7 +559,6 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
|
||||
// Parse the individual sheets
|
||||
foreach ($this->_sheets as $sheet) {
|
||||
|
||||
if ($sheet['sheetType'] != 0x00) {
|
||||
// 0x00: Worksheet
|
||||
// 0x02: Chart
|
||||
|
@ -811,7 +810,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula
|
||||
// cells... during the load, all formulae should be correct, and we're simply bringing the worksheet
|
||||
// name in line with the formula, not the reverse
|
||||
$this->_phpSheet->setTitle($sheet['name'],false);
|
||||
$this->_phpSheet->setTitle($sheet['name'], false);
|
||||
$this->_phpSheet->setSheetState($sheet['sheetState']);
|
||||
|
||||
$this->_pos = $sheet['offset'];
|
||||
|
@ -1133,7 +1132,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
// echo '<b>Cell annotation ', $note,'</b><br />';
|
||||
// var_dump($noteDetails);
|
||||
// echo '<br />';
|
||||
$cellAddress = str_replace('$','', $noteDetails['cellRef']);
|
||||
$cellAddress = str_replace('$', '', $noteDetails['cellRef']);
|
||||
$this->_phpSheet->getComment($cellAddress)->setAuthor($noteDetails['author'])->setText($this->_parseRichText($noteDetails['objTextData']['text']));
|
||||
}
|
||||
}
|
||||
|
@ -1185,7 +1184,6 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
$explodes = explode('!', $range);
|
||||
if (count($explodes) == 2) {
|
||||
if ($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) {
|
||||
|
||||
$extractedRange = $explodes[1];
|
||||
$extractedRange = str_replace('$', '', $extractedRange);
|
||||
|
||||
|
@ -1213,7 +1211,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
|
||||
if (count($explodes) == 2) {
|
||||
if (($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) ||
|
||||
($docSheet = $this->_phpExcel->getSheetByName(trim($explodes[0],"'")))) {
|
||||
($docSheet = $this->_phpExcel->getSheetByName(trim($explodes[0], "'")))) {
|
||||
$extractedRange = $explodes[1];
|
||||
$extractedRange = str_replace('$', '', $extractedRange);
|
||||
|
||||
|
@ -1639,7 +1637,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
}
|
||||
// echo 'Note Address=', $cellAddress,'<br />';
|
||||
|
||||
$cellAddress = str_replace('$','', $cellAddress);
|
||||
$cellAddress = str_replace('$', '', $cellAddress);
|
||||
$noteLength = self::_GetInt2d($recordData, 4);
|
||||
$noteText = trim(substr($recordData, 6));
|
||||
// echo 'Note Length=', $noteLength,'<br />';
|
||||
|
@ -1965,12 +1963,16 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
// bit: 0; mask 0x0001; bold (redundant in BIFF5-BIFF8)
|
||||
// bit: 1; mask 0x0002; italic
|
||||
$isItalic = (0x0002 & self::_GetInt2d($recordData, 2)) >> 1;
|
||||
if ($isItalic) $objFont->setItalic(true);
|
||||
if ($isItalic) {
|
||||
$objFont->setItalic(true);
|
||||
}
|
||||
|
||||
// bit: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8)
|
||||
// bit: 3; mask 0x0008; strike
|
||||
$isStrike = (0x0008 & self::_GetInt2d($recordData, 2)) >> 3;
|
||||
if ($isStrike) $objFont->setStrikethrough(true);
|
||||
if ($isStrike) {
|
||||
$objFont->setStrikethrough(true);
|
||||
}
|
||||
|
||||
// offset: 4; size: 2; colour index
|
||||
$colorIndex = self::_GetInt2d($recordData, 4);
|
||||
|
@ -2557,11 +2559,11 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
$builtInId = ord($recordData{2});
|
||||
|
||||
switch ($builtInId) {
|
||||
case 0x00:
|
||||
// currently, we are not using this for anything
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 0x00:
|
||||
// currently, we are not using this for anything
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// user-defined; not supported by PHPExcel
|
||||
|
@ -2891,7 +2893,6 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
|
||||
// loop through the Unicode strings (16-bit length)
|
||||
for ($i = 0; $i < $nm; ++$i) {
|
||||
|
||||
// number of characters in the Unicode string
|
||||
$numChars = self::_GetInt2d($recordData, $pos);
|
||||
$pos += 2;
|
||||
|
@ -3923,21 +3924,18 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
} elseif ((ord($recordData{6}) == 1)
|
||||
&& (ord($recordData{12}) == 255)
|
||||
&& (ord($recordData{13}) == 255)) {
|
||||
|
||||
// Boolean formula. Result is in +2; 0=false, 1=true
|
||||
$dataType = PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||
$value = (bool) ord($recordData{8});
|
||||
} elseif ((ord($recordData{6}) == 2)
|
||||
&& (ord($recordData{12}) == 255)
|
||||
&& (ord($recordData{13}) == 255)) {
|
||||
|
||||
// Error formula. Error code is in +2
|
||||
$dataType = PHPExcel_Cell_DataType::TYPE_ERROR;
|
||||
$value = self::_mapErrorCode(ord($recordData{8}));
|
||||
} elseif ((ord($recordData{6}) == 3)
|
||||
&& (ord($recordData{12}) == 255)
|
||||
&& (ord($recordData{13}) == 255)) {
|
||||
|
||||
// Formula result is a null string
|
||||
$dataType = PHPExcel_Cell_DataType::TYPE_NULL;
|
||||
$value = '';
|
||||
|
@ -4352,7 +4350,8 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
/**
|
||||
* Read PLV Record(Created by Excel2007 or upper)
|
||||
*/
|
||||
private function _readPageLayoutView() {
|
||||
private function _readPageLayoutView()
|
||||
{
|
||||
$length = self::_GetInt2d($this->_data, $this->_pos + 2);
|
||||
$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);
|
||||
|
||||
|
@ -4528,7 +4527,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) {
|
||||
$cellRangeAddressList = $this->_readBIFF8CellRangeAddressList($recordData);
|
||||
foreach ($cellRangeAddressList['cellRangeAddresses'] as $cellRangeAddress) {
|
||||
if ((strpos($cellRangeAddress,':') !== false) &&
|
||||
if ((strpos($cellRangeAddress, ':') !== false) &&
|
||||
($this->_includeCellRangeFiltered($cellRangeAddress))) {
|
||||
$this->_phpSheet->mergeCells($cellRangeAddress);
|
||||
}
|
||||
|
@ -4620,8 +4619,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
// offset: var; size: $us; character array of the URL, no Unicode string header, always 16-bit characters, zero-terminated
|
||||
$url = self::_encodeUTF16(substr($recordData, $offset, $us - 2), false);
|
||||
$nullOffset = strpos($url, 0x00);
|
||||
if ($nullOffset)
|
||||
$url = substr($url,0, $nullOffset);
|
||||
if ($nullOffset) {
|
||||
$url = substr($url, 0, $nullOffset);
|
||||
}
|
||||
$url .= $hasText ? '#' : '';
|
||||
$offset += $us;
|
||||
break;
|
||||
|
@ -5328,7 +5328,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
* @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
|
||||
* @return string Human readable formula
|
||||
*/
|
||||
private function _getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1')
|
||||
private function _getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1')
|
||||
{
|
||||
// start parsing the formula data
|
||||
$tokens = array();
|
||||
|
@ -7468,13 +7468,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
$mantissa = (0x100000 | ($rknumhigh & 0x000fffff));
|
||||
$mantissalow1 = ($rknumlow & 0x80000000) >> 31;
|
||||
$mantissalow2 = ($rknumlow & 0x7fffffff);
|
||||
$value = $mantissa / pow(2 , (20 - $exp));
|
||||
$value = $mantissa / pow(2, (20 - $exp));
|
||||
|
||||
if ($mantissalow1 != 0) {
|
||||
$value += 1 / pow (2 , (21 - $exp));
|
||||
$value += 1 / pow (2, (21 - $exp));
|
||||
}
|
||||
|
||||
$value += $mantissalow2 / pow (2 , (52 - $exp));
|
||||
$value += $mantissalow2 / pow (2, (52 - $exp));
|
||||
if ($sign) {
|
||||
$value *= -1;
|
||||
}
|
||||
|
@ -7496,7 +7496,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
$sign = ($rknum & 0x80000000) >> 31;
|
||||
$exp = ($rknum & 0x7ff00000) >> 20;
|
||||
$mantissa = (0x100000 | ($rknum & 0x000ffffc));
|
||||
$value = $mantissa / pow(2 , (20- ($exp - 1023)));
|
||||
$value = $mantissa / pow(2, (20- ($exp - 1023)));
|
||||
if ($sign) {
|
||||
$value = -1 * $value;
|
||||
}
|
||||
|
@ -7520,7 +7520,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
{
|
||||
if ($compressed) {
|
||||
$string = self::_uncompressByteString($string);
|
||||
}
|
||||
}
|
||||
|
||||
return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', 'UTF-16LE');
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
|||
|
||||
$xml = new XMLReader();
|
||||
$xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||
$xml->setParserProperty(2,true);
|
||||
$xml->setParserProperty(2, true);
|
||||
|
||||
$worksheetNames = array();
|
||||
while ($xml->read()) {
|
||||
|
@ -467,7 +467,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
|||
}
|
||||
|
||||
if ((!$this->_readDataOnly) && (isset($sheet->Objects))) {
|
||||
foreach ($sheet->Objects->children('gnm',TRUE) as $key => $comment) {
|
||||
foreach ($sheet->Objects->children('gnm', true) as $key => $comment) {
|
||||
$commentAttributes = $comment->attributes();
|
||||
// Only comment objects are handled at the moment
|
||||
if ($commentAttributes->Text) {
|
||||
|
@ -481,7 +481,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
|||
$styleAttributes = $styleRegion->attributes();
|
||||
if (($styleAttributes['startRow'] <= $maxRow) &&
|
||||
($styleAttributes['startCol'] <= $maxCol)) {
|
||||
|
||||
$startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']);
|
||||
$startRow = $styleAttributes['startRow'] + 1;
|
||||
|
||||
|
@ -748,7 +747,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
|||
// Handle Merged Cells in this worksheet
|
||||
if (isset($sheet->MergedRegions)) {
|
||||
foreach ($sheet->MergedRegions->Merge as $mergeCells) {
|
||||
if (strpos($mergeCells,':') !== false) {
|
||||
if (strpos($mergeCells, ':') !== false) {
|
||||
$objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
|
||||
}
|
||||
}
|
||||
|
@ -767,7 +766,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
|||
}
|
||||
|
||||
$range = explode('!', $range);
|
||||
$range[0] = trim($range[0],"'");;
|
||||
$range[0] = trim($range[0], "'");
|
||||
if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
|
||||
$extractedRange = str_replace('$', '', $range[1]);
|
||||
$objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $worksheet, $extractedRange));
|
||||
|
@ -844,7 +843,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
|||
return $value;
|
||||
}
|
||||
|
||||
private static function _parseGnumericColour($gnmColour) {
|
||||
private static function _parseGnumericColour($gnmColour)
|
||||
{
|
||||
list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour);
|
||||
$gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2);
|
||||
$gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2);
|
||||
|
|
|
@ -54,7 +54,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
/**
|
||||
* Create a new PHPExcel_Reader_OOCalc
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||
}
|
||||
|
||||
|
@ -304,7 +305,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||
}
|
||||
|
||||
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue)
|
||||
private static function identifyFixedStyleValue($styleList, &$styleAttributeValue)
|
||||
{
|
||||
$styleAttributeValue = strtolower($styleAttributeValue);
|
||||
foreach ($styleList as $style) {
|
||||
|
@ -358,22 +359,22 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
foreach ($officePropertyDC as $propertyName => $propertyValue) {
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
case 'title' :
|
||||
case 'title':
|
||||
$docProps->setTitle($propertyValue);
|
||||
break;
|
||||
case 'subject' :
|
||||
case 'subject':
|
||||
$docProps->setSubject($propertyValue);
|
||||
break;
|
||||
case 'creator' :
|
||||
case 'creator':
|
||||
$docProps->setCreator($propertyValue);
|
||||
$docProps->setLastModifiedBy($propertyValue);
|
||||
break;
|
||||
case 'date' :
|
||||
case 'date':
|
||||
$creationDate = strtotime($propertyValue);
|
||||
$docProps->setCreated($creationDate);
|
||||
$docProps->setModified($creationDate);
|
||||
break;
|
||||
case 'description' :
|
||||
case 'description':
|
||||
$docProps->setDescription($propertyValue);
|
||||
break;
|
||||
}
|
||||
|
@ -386,36 +387,36 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
$propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
case 'initial-creator' :
|
||||
case 'initial-creator':
|
||||
$docProps->setCreator($propertyValue);
|
||||
break;
|
||||
case 'keyword' :
|
||||
case 'keyword':
|
||||
$docProps->setKeywords($propertyValue);
|
||||
break;
|
||||
case 'creation-date' :
|
||||
case 'creation-date':
|
||||
$creationDate = strtotime($propertyValue);
|
||||
$docProps->setCreated($creationDate);
|
||||
break;
|
||||
case 'user-defined' :
|
||||
case 'user-defined':
|
||||
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
|
||||
foreach ($propertyValueAttributes as $key => $value) {
|
||||
if ($key == 'name') {
|
||||
$propertyValueName = (string) $value;
|
||||
} elseif ($key == 'value-type') {
|
||||
switch ($value) {
|
||||
case 'date' :
|
||||
case 'date':
|
||||
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'date');
|
||||
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
|
||||
break;
|
||||
case 'boolean' :
|
||||
case 'boolean':
|
||||
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'bool');
|
||||
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
|
||||
break;
|
||||
case 'float' :
|
||||
case 'float':
|
||||
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'r4');
|
||||
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
|
||||
}
|
||||
}
|
||||
|
@ -459,7 +460,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in
|
||||
// formula cells... during the load, all formulae should be correct, and we're simply
|
||||
// bringing the worksheet name in line with the formula, not the reverse
|
||||
$objPHPExcel->getActiveSheet()->setTitle($worksheetName,false);
|
||||
$objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
|
||||
}
|
||||
|
||||
$rowID = 1;
|
||||
|
@ -471,10 +472,9 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
$rowData = $cellData;
|
||||
break;
|
||||
}
|
||||
case 'table-row' :
|
||||
case 'table-row':
|
||||
$rowDataTableAttributes = $rowData->attributes($namespacesContent['table']);
|
||||
$rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ?
|
||||
$rowDataTableAttributes['number-rows-repeated'] : 1;
|
||||
$rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? $rowDataTableAttributes['number-rows-repeated'] : 1;
|
||||
$columnID = 'A';
|
||||
foreach ($rowData as $key => $cellData) {
|
||||
if ($this->getReadFilter() !== null) {
|
||||
|
@ -484,9 +484,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
}
|
||||
|
||||
// echo '<b>'.$columnID.$rowID.'</b><br />';
|
||||
$cellDataText = (isset($namespacesContent['text'])) ?
|
||||
$cellData->children($namespacesContent['text']) :
|
||||
'';
|
||||
$cellDataText = (isset($namespacesContent['text'])) ? $cellData->children($namespacesContent['text']) : '';
|
||||
$cellDataOffice = $cellData->children($namespacesContent['office']);
|
||||
$cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
|
||||
$cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
|
||||
|
@ -522,9 +520,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
}
|
||||
$text = implode("\n", $textArray);
|
||||
// echo $text, '<br />';
|
||||
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID )
|
||||
$objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setText($this->_parseRichText($text));
|
||||
// ->setAuthor( $author )
|
||||
->setText($this->_parseRichText($text) );
|
||||
}
|
||||
|
||||
if (isset($cellDataText->p)) {
|
||||
|
@ -550,7 +547,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
|
||||
// echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
|
||||
switch ($cellDataOfficeAttributes['value-type']) {
|
||||
case 'string' :
|
||||
case 'string':
|
||||
$type = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
$dataValue = $allCellDataText;
|
||||
if (isset($dataValue->a)) {
|
||||
|
@ -559,11 +556,11 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
$hyperlink = $cellXLinkAttributes['href'];
|
||||
}
|
||||
break;
|
||||
case 'boolean' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||
$dataValue = ($allCellDataText == 'TRUE') ? true : false;
|
||||
break;
|
||||
case 'percentage' :
|
||||
case 'boolean':
|
||||
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||
$dataValue = ($allCellDataText == 'TRUE') ? true : false;
|
||||
break;
|
||||
case 'percentage':
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||
if (floor($dataValue) == $dataValue) {
|
||||
|
@ -571,7 +568,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
}
|
||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00;
|
||||
break;
|
||||
case 'currency' :
|
||||
case 'currency':
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||
if (floor($dataValue) == $dataValue) {
|
||||
|
@ -579,17 +576,18 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
}
|
||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
|
||||
break;
|
||||
case 'float' :
|
||||
case 'float':
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||
if (floor($dataValue) == $dataValue) {
|
||||
if ($dataValue == (integer) $dataValue)
|
||||
if ($dataValue == (integer) $dataValue) {
|
||||
$dataValue = (integer) $dataValue;
|
||||
else
|
||||
} else {
|
||||
$dataValue = (float) $dataValue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'date' :
|
||||
case 'date':
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT);
|
||||
$dateObj->setTimeZone($timezoneObj);
|
||||
|
@ -601,9 +599,9 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15;
|
||||
}
|
||||
break;
|
||||
case 'time' :
|
||||
case 'time':
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':',sscanf($cellDataOfficeAttributes['time-value'], 'PT%dH%dM%dS'))));
|
||||
$dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':', sscanf($cellDataOfficeAttributes['time-value'], 'PT%dH%dM%dS'))));
|
||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
|
||||
break;
|
||||
}
|
||||
|
@ -619,7 +617,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
|||
if ($hasCalculatedValue) {
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
// echo 'Formula: ', $cellDataFormula, PHP_EOL;
|
||||
$cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula, ':=')+1);
|
||||
$cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=')+1);
|
||||
$temp = explode('"', $cellDataFormula);
|
||||
$tKey = false;
|
||||
foreach ($temp as &$value) {
|
||||
|
|
|
@ -269,7 +269,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
|||
$formatArray['font']['size'] = substr($rowDatum, 1);
|
||||
break;
|
||||
case 'S':
|
||||
$styleSettings = substr($rowDatum,1);
|
||||
$styleSettings = substr($rowDatum, 1);
|
||||
for ($i=0; $i<strlen($styleSettings); ++$i) {
|
||||
switch ($styleSettings{$i}) {
|
||||
case 'I':
|
||||
|
|
|
@ -72,7 +72,7 @@ class EigenvalueDecomposition
|
|||
*
|
||||
* @access private
|
||||
*/
|
||||
private function tred2 ()
|
||||
private function tred2()
|
||||
{
|
||||
// This is derived from the Algol procedures tred2 by
|
||||
// Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
|
||||
|
@ -189,7 +189,7 @@ class EigenvalueDecomposition
|
|||
$this->e[$this->n-1] = 0.0;
|
||||
$f = 0.0;
|
||||
$tst1 = 0.0;
|
||||
$eps = pow(2.0,-52.0);
|
||||
$eps = pow(2.0, -52.0);
|
||||
|
||||
for ($l = 0; $l < $this->n; ++$l) {
|
||||
// Find small subdiagonal element
|
||||
|
@ -741,7 +741,7 @@ class EigenvalueDecomposition
|
|||
}
|
||||
}
|
||||
// Overflow control
|
||||
$t = max(abs($this->H[$i][$n-1]),abs($this->H[$i][$n]));
|
||||
$t = max(abs($this->H[$i][$n-1]), abs($this->H[$i][$n]));
|
||||
if (($eps * $t) * $t > 1) {
|
||||
for ($j = $i; $j <= $n; ++$j) {
|
||||
$this->H[$j][$n-1] = $this->H[$j][$n-1] / $t;
|
||||
|
|
|
@ -95,8 +95,8 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
$this->n = 0;
|
||||
}
|
||||
if (($this->m * $this->n) == count($args[0])) {
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$this->A[$i][$j] = $args[0][$i + $j * $this->m];
|
||||
}
|
||||
}
|
||||
|
@ -176,11 +176,19 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
//A($i0...; $j0...)
|
||||
case 'integer,integer':
|
||||
list($i0, $j0) = $args;
|
||||
if ($i0 >= 0) { $m = $this->m - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if ($j0 >= 0) { $n = $this->n - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if ($i0 >= 0) {
|
||||
$m = $this->m - $i0;
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
if ($j0 >= 0) {
|
||||
$n = $this->n - $j0;
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
|
||||
for($i = $i0; $i < $this->m; ++$i) {
|
||||
for($j = $j0; $j < $this->n; ++$j) {
|
||||
for ($i = $i0; $i < $this->m; ++$i) {
|
||||
for ($j = $j0; $j < $this->n; ++$j) {
|
||||
$R->set($i, $j, $this->A[$i][$j]);
|
||||
}
|
||||
}
|
||||
|
@ -189,11 +197,15 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
//A($i0...$iF; $j0...$jF)
|
||||
case 'integer,integer,integer,integer':
|
||||
list($i0, $iF, $j0, $jF) = $args;
|
||||
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
|
||||
$m = $iF - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) {
|
||||
$n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
$R = new PHPExcel_Shared_JAMA_Matrix($m+1, $n+1);
|
||||
for($i = $i0; $i <= $iF; ++$i) {
|
||||
for($j = $j0; $j <= $jF; ++$j) {
|
||||
for ($i = $i0; $i <= $iF; ++$i) {
|
||||
for ($j = $j0; $j <= $jF; ++$j) {
|
||||
$R->set($i - $i0, $j - $j0, $this->A[$i][$j]);
|
||||
}
|
||||
}
|
||||
|
@ -202,11 +214,19 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
//$R = array of row indices; $C = array of column indices
|
||||
case 'array,array':
|
||||
list($RL, $CL) = $args;
|
||||
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if (count($RL) > 0) {
|
||||
$m = count($RL);
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
if (count($CL) > 0) {
|
||||
$n = count($CL);
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
|
||||
for($i = 0; $i < $m; ++$i) {
|
||||
for($j = 0; $j < $n; ++$j) {
|
||||
for ($i = 0; $i < $m; ++$i) {
|
||||
for ($j = 0; $j < $n; ++$j) {
|
||||
$R->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$j]]);
|
||||
}
|
||||
}
|
||||
|
@ -215,11 +235,19 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
//$RL = array of row indices; $CL = array of column indices
|
||||
case 'array,array':
|
||||
list($RL, $CL) = $args;
|
||||
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if (count($RL) > 0) {
|
||||
$m = count($RL);
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
if (count($CL) > 0) {
|
||||
$n = count($CL);
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
|
||||
for($i = 0; $i < $m; ++$i) {
|
||||
for($j = 0; $j < $n; ++$j) {
|
||||
for ($i = 0; $i < $m; ++$i) {
|
||||
for ($j = 0; $j < $n; ++$j) {
|
||||
$R->set($i, $j, $this->A[$RL[$i]][$CL[$j]]);
|
||||
}
|
||||
}
|
||||
|
@ -228,11 +256,19 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
//A($i0...$iF); $CL = array of column indices
|
||||
case 'integer,integer,array':
|
||||
list($i0, $iF, $CL) = $args;
|
||||
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
|
||||
$m = $iF - $i0;
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
if (count($CL) > 0) {
|
||||
$n = count($CL);
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
|
||||
for($i = $i0; $i < $iF; ++$i) {
|
||||
for($j = 0; $j < $n; ++$j) {
|
||||
for ($i = $i0; $i < $iF; ++$i) {
|
||||
for ($j = 0; $j < $n; ++$j) {
|
||||
$R->set($i - $i0, $j, $this->A[$RL[$i]][$j]);
|
||||
}
|
||||
}
|
||||
|
@ -241,11 +277,19 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
//$RL = array of row indices
|
||||
case 'array,integer,integer':
|
||||
list($RL, $j0, $jF) = $args;
|
||||
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); }
|
||||
if (count($RL) > 0) {
|
||||
$m = count($RL);
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) {
|
||||
$n = $jF - $j0;
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
|
||||
}
|
||||
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n+1);
|
||||
for($i = 0; $i < $m; ++$i) {
|
||||
for($j = $j0; $j <= $jF; ++$j) {
|
||||
for ($i = 0; $i < $m; ++$i) {
|
||||
for ($j = $j0; $j <= $jF; ++$j) {
|
||||
$R->set($i, $j - $j0, $this->A[$RL[$i]][$j]);
|
||||
}
|
||||
}
|
||||
|
@ -320,7 +364,7 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
public function diagonal($m = null, $n = null, $c = 1)
|
||||
{
|
||||
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
|
||||
for($i = 0; $i < $m; ++$i) {
|
||||
for ($i = 0; $i < $m; ++$i) {
|
||||
$R->set($i, $i, $c);
|
||||
}
|
||||
return $R;
|
||||
|
@ -377,8 +421,8 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
public function transpose()
|
||||
{
|
||||
$R = new PHPExcel_Shared_JAMA_Matrix($this->n, $this->m);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$R->set($j, $i, $this->A[$i][$j]);
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +439,7 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
{
|
||||
$s = 0;
|
||||
$n = min($this->m, $this->n);
|
||||
for($i = 0; $i < $n; ++$i) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$s += $this->A[$i][$i];
|
||||
}
|
||||
return $s;
|
||||
|
@ -440,8 +484,8 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]);
|
||||
}
|
||||
}
|
||||
|
@ -480,16 +524,16 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$validValues = true;
|
||||
$value = $M->get($i, $j);
|
||||
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j],'"');
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j], '"');
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
|
||||
}
|
||||
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
|
||||
$value = trim($value,'"');
|
||||
$value = trim($value, '"');
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||
}
|
||||
if ($validValues) {
|
||||
|
@ -534,8 +578,8 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$M->set($i, $j, $M->get($i, $j) - $this->A[$i][$j]);
|
||||
}
|
||||
}
|
||||
|
@ -574,16 +618,16 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$validValues = true;
|
||||
$value = $M->get($i, $j);
|
||||
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j],'"');
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j], '"');
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
|
||||
}
|
||||
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
|
||||
$value = trim($value,'"');
|
||||
$value = trim($value, '"');
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||
}
|
||||
if ($validValues) {
|
||||
|
@ -629,8 +673,8 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$M->set($i, $j, $M->get($i, $j) * $this->A[$i][$j]);
|
||||
}
|
||||
}
|
||||
|
@ -670,16 +714,16 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$validValues = true;
|
||||
$value = $M->get($i, $j);
|
||||
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j],'"');
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j], '"');
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
|
||||
}
|
||||
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
|
||||
$value = trim($value,'"');
|
||||
$value = trim($value, '"');
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||
}
|
||||
if ($validValues) {
|
||||
|
@ -725,16 +769,16 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$validValues = true;
|
||||
$value = $M->get($i, $j);
|
||||
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j],'"');
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j], '"');
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
|
||||
}
|
||||
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
|
||||
$value = trim($value,'"');
|
||||
$value = trim($value, '"');
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||
}
|
||||
if ($validValues) {
|
||||
|
@ -786,8 +830,8 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$this->A[$i][$j] = $this->A[$i][$j] / $M->get($i, $j);
|
||||
}
|
||||
}
|
||||
|
@ -828,8 +872,8 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$M->set($i, $j, $M->get($i, $j) / $this->A[$i][$j]);
|
||||
}
|
||||
}
|
||||
|
@ -870,8 +914,8 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$this->A[$i][$j] = $M->get($i, $j) / $this->A[$i][$j];
|
||||
}
|
||||
}
|
||||
|
@ -904,14 +948,14 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
}
|
||||
if ($this->n == $B->m) {
|
||||
$C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n);
|
||||
for($j = 0; $j < $B->n; ++$j) {
|
||||
for ($j = 0; $j < $B->n; ++$j) {
|
||||
for ($k = 0; $k < $this->n; ++$k) {
|
||||
$Bcolj[$k] = $B->A[$k][$j];
|
||||
}
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
$Arowi = $this->A[$i];
|
||||
$s = 0;
|
||||
for($k = 0; $k < $this->n; ++$k) {
|
||||
for ($k = 0; $k < $this->n; ++$k) {
|
||||
$s += $Arowi[$k] * $Bcolj[$k];
|
||||
}
|
||||
$C->A[$i][$j] = $s;
|
||||
|
@ -926,10 +970,10 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
$B = new PHPExcel_Shared_JAMA_Matrix($args[0]);
|
||||
if ($this->n == $B->m) {
|
||||
$C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n);
|
||||
for($i = 0; $i < $C->m; ++$i) {
|
||||
for($j = 0; $j < $C->n; ++$j) {
|
||||
for ($i = 0; $i < $C->m; ++$i) {
|
||||
for ($j = 0; $j < $C->n; ++$j) {
|
||||
$s = "0";
|
||||
for($k = 0; $k < $C->n; ++$k) {
|
||||
for ($k = 0; $k < $C->n; ++$k) {
|
||||
$s += $this->A[$i][$k] * $B->A[$k][$j];
|
||||
}
|
||||
$C->A[$i][$j] = $s;
|
||||
|
@ -943,8 +987,8 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
case 'integer':
|
||||
$C = new PHPExcel_Shared_JAMA_Matrix($this->A);
|
||||
for($i = 0; $i < $C->m; ++$i) {
|
||||
for($j = 0; $j < $C->n; ++$j) {
|
||||
for ($i = 0; $i < $C->m; ++$i) {
|
||||
for ($j = 0; $j < $C->n; ++$j) {
|
||||
$C->A[$i][$j] *= $args[0];
|
||||
}
|
||||
}
|
||||
|
@ -952,8 +996,8 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
case 'double':
|
||||
$C = new PHPExcel_Shared_JAMA_Matrix($this->m, $this->n);
|
||||
for($i = 0; $i < $C->m; ++$i) {
|
||||
for($j = 0; $j < $C->n; ++$j) {
|
||||
for ($i = 0; $i < $C->m; ++$i) {
|
||||
for ($j = 0; $j < $C->n; ++$j) {
|
||||
$C->A[$i][$j] = $args[0] * $this->A[$i][$j];
|
||||
}
|
||||
}
|
||||
|
@ -961,8 +1005,8 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
case 'float':
|
||||
$C = new PHPExcel_Shared_JAMA_Matrix($this->A);
|
||||
for($i = 0; $i < $C->m; ++$i) {
|
||||
for($j = 0; $j < $C->n; ++$j) {
|
||||
for ($i = 0; $i < $C->m; ++$i) {
|
||||
for ($j = 0; $j < $C->n; ++$j) {
|
||||
$C->A[$i][$j] *= $args[0];
|
||||
}
|
||||
}
|
||||
|
@ -1006,16 +1050,16 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$validValues = true;
|
||||
$value = $M->get($i, $j);
|
||||
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j],'"');
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j], '"');
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
|
||||
}
|
||||
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
|
||||
$value = trim($value,'"');
|
||||
$value = trim($value, '"');
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||
}
|
||||
if ($validValues) {
|
||||
|
@ -1059,9 +1103,9 @@ class PHPExcel_Shared_JAMA_Matrix
|
|||
break;
|
||||
}
|
||||
$this->checkMatrixDimensions($M);
|
||||
for($i = 0; $i < $this->m; ++$i) {
|
||||
for($j = 0; $j < $this->n; ++$j) {
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j],'"').trim($M->get($i, $j),'"');
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
$this->A[$i][$j] = trim($this->A[$i][$j], '"').trim($M->get($i, $j), '"');
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
|
|
|
@ -233,4 +233,3 @@ class PHPExcel_Shared_JAMA_QRDecomposition
|
|||
}
|
||||
} // function solve()
|
||||
}
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ class SingularValueDecomposition
|
|||
break;
|
||||
}
|
||||
$t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks-1]) : 0.);
|
||||
if (abs($this->s[$ks]) <= $eps * $t) {
|
||||
if (abs($this->s[$ks]) <= $eps * $t) {
|
||||
$this->s[$ks] = 0.0;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
|||
$this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir();
|
||||
}
|
||||
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
|
||||
$this->_FILEH_ = fopen($this->_tmp_filename,"w+b");
|
||||
$this->_FILEH_ = fopen($this->_tmp_filename, "w+b");
|
||||
if ($this->_FILEH_ == false) {
|
||||
throw new PHPExcel_Writer_Exception("Can't create temporary file.");
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
|||
. pack("V", 0x1000)
|
||||
. pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
|
||||
. pack("V", $iSBDcnt)
|
||||
);
|
||||
);
|
||||
// Extra BDList Start, Count
|
||||
if ($iBdCnt < $i1stBdL) {
|
||||
fwrite(
|
||||
|
|
|
@ -3458,7 +3458,6 @@ class PclZip
|
|||
}
|
||||
|
||||
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
|
||||
|
||||
// ----- Change the file status
|
||||
$p_entry['status'] = "path_creation_fail";
|
||||
|
||||
|
|
|
@ -15,452 +15,452 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
|
|||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDATE
|
||||
*/
|
||||
public function testDATE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDATE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerDATE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATE.data');
|
||||
}
|
||||
|
||||
public function testDATEtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(1327968000, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDATEtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(1327968000, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function testDATEtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
public function testDATEtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
// Must return an object...
|
||||
$this->assertTrue(is_object($result));
|
||||
// ... of the correct type
|
||||
$this->assertTrue(is_a($result,'DateTime'));
|
||||
// ... with the correct value
|
||||
$this->assertEquals($result->format('d-M-Y'),'31-Jan-2012');
|
||||
}
|
||||
}
|
||||
|
||||
public function testDATEwith1904Calendar()
|
||||
{
|
||||
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
|
||||
$result = PHPExcel_Calculation_DateTime::DATE(1918,11,11);
|
||||
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
|
||||
public function testDATEwith1904Calendar()
|
||||
{
|
||||
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
|
||||
$result = PHPExcel_Calculation_DateTime::DATE(1918,11,11);
|
||||
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
|
||||
$this->assertEquals($result,5428);
|
||||
}
|
||||
}
|
||||
|
||||
public function testDATEwith1904CalendarError()
|
||||
{
|
||||
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
|
||||
$result = PHPExcel_Calculation_DateTime::DATE(1901,1,31);
|
||||
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
|
||||
public function testDATEwith1904CalendarError()
|
||||
{
|
||||
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
|
||||
$result = PHPExcel_Calculation_DateTime::DATE(1901,1,31);
|
||||
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
|
||||
$this->assertEquals($result,'#NUM!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDATEVALUE
|
||||
*/
|
||||
public function testDATEVALUE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEVALUE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDATEVALUE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEVALUE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerDATEVALUE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEVALUE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEVALUE.data');
|
||||
}
|
||||
|
||||
public function testDATEVALUEtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31');
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(1327968000, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDATEVALUEtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31');
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(1327968000, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function testDATEVALUEtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31');
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
public function testDATEVALUEtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31');
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
// Must return an object...
|
||||
$this->assertTrue(is_object($result));
|
||||
// ... of the correct type
|
||||
$this->assertTrue(is_a($result,'DateTime'));
|
||||
// ... with the correct value
|
||||
$this->assertEquals($result->format('d-M-Y'),'31-Jan-2012');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerYEAR
|
||||
*/
|
||||
public function testYEAR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEAR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testYEAR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEAR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerYEAR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/YEAR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/YEAR.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerMONTH
|
||||
*/
|
||||
public function testMONTH()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MONTHOFYEAR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testMONTH()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MONTHOFYEAR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerMONTH()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/MONTH.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/MONTH.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerWEEKNUM
|
||||
*/
|
||||
public function testWEEKNUM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WEEKOFYEAR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testWEEKNUM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WEEKOFYEAR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerWEEKNUM()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKNUM.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKNUM.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerWEEKDAY
|
||||
*/
|
||||
public function testWEEKDAY()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFWEEK'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testWEEKDAY()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFWEEK'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerWEEKDAY()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKDAY.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKDAY.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDAY
|
||||
*/
|
||||
public function testDAY()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFMONTH'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDAY()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFMONTH'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerDAY()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/DAY.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/DAY.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerTIME
|
||||
*/
|
||||
public function testTIME()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIME'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testTIME()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIME'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerTIME()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/TIME.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/TIME.data');
|
||||
}
|
||||
|
||||
public function testTIMEtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(27020, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testTIMEtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(27020, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function testTIMEtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
public function testTIMEtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
// Must return an object...
|
||||
$this->assertTrue(is_object($result));
|
||||
// ... of the correct type
|
||||
$this->assertTrue(is_a($result,'DateTime'));
|
||||
// ... with the correct value
|
||||
$this->assertEquals($result->format('H:i:s'),'07:30:20');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerTIMEVALUE
|
||||
*/
|
||||
public function testTIMEVALUE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIMEVALUE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testTIMEVALUE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIMEVALUE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerTIMEVALUE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/TIMEVALUE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/TIMEVALUE.data');
|
||||
}
|
||||
|
||||
public function testTIMEVALUEtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20');
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(23420, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testTIMEVALUEtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20');
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(23420, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function testTIMEVALUEtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20');
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
public function testTIMEVALUEtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20');
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
// Must return an object...
|
||||
$this->assertTrue(is_object($result));
|
||||
// ... of the correct type
|
||||
$this->assertTrue(is_a($result,'DateTime'));
|
||||
// ... with the correct value
|
||||
$this->assertEquals($result->format('H:i:s'),'07:30:20');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerHOUR
|
||||
*/
|
||||
public function testHOUR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','HOUROFDAY'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testHOUR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','HOUROFDAY'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerHOUR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/HOUR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/HOUR.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerMINUTE
|
||||
*/
|
||||
public function testMINUTE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MINUTEOFHOUR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testMINUTE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MINUTEOFHOUR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerMINUTE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/MINUTE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/MINUTE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerSECOND
|
||||
*/
|
||||
public function testSECOND()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','SECONDOFMINUTE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testSECOND()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','SECONDOFMINUTE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerSECOND()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/SECOND.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/SECOND.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerNETWORKDAYS
|
||||
*/
|
||||
public function testNETWORKDAYS()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','NETWORKDAYS'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testNETWORKDAYS()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','NETWORKDAYS'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerNETWORKDAYS()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/NETWORKDAYS.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/NETWORKDAYS.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerWORKDAY
|
||||
*/
|
||||
public function testWORKDAY()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WORKDAY'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testWORKDAY()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WORKDAY'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerWORKDAY()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/WORKDAY.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/WORKDAY.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerEDATE
|
||||
*/
|
||||
public function testEDATE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EDATE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testEDATE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EDATE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerEDATE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/EDATE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/EDATE.data');
|
||||
}
|
||||
|
||||
public function testEDATEtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(1324857600, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testEDATEtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(1324857600, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function testEDATEtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
public function testEDATEtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
// Must return an object...
|
||||
$this->assertTrue(is_object($result));
|
||||
// ... of the correct type
|
||||
$this->assertTrue(is_a($result,'DateTime'));
|
||||
// ... with the correct value
|
||||
$this->assertEquals($result->format('d-M-Y'),'26-Dec-2011');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerEOMONTH
|
||||
*/
|
||||
public function testEOMONTH()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EOMONTH'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testEOMONTH()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EOMONTH'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerEOMONTH()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/EOMONTH.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/EOMONTH.data');
|
||||
}
|
||||
|
||||
public function testEOMONTHtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(1325289600, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testEOMONTHtoPHP()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
|
||||
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
$this->assertEquals(1325289600, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function testEOMONTHtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
public function testEOMONTHtoPHPObject()
|
||||
{
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
|
||||
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1);
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
// Must return an object...
|
||||
$this->assertTrue(is_object($result));
|
||||
// ... of the correct type
|
||||
$this->assertTrue(is_a($result,'DateTime'));
|
||||
// ... with the correct value
|
||||
$this->assertEquals($result->format('d-M-Y'),'31-Dec-2011');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDATEDIF
|
||||
*/
|
||||
public function testDATEDIF()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEDIF'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDATEDIF()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEDIF'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerDATEDIF()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEDIF.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEDIF.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDAYS360
|
||||
*/
|
||||
public function testDAYS360()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYS360'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDAYS360()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYS360'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerDAYS360()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/DAYS360.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/DAYS360.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerYEARFRAC
|
||||
*/
|
||||
public function testYEARFRAC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEARFRAC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testYEARFRAC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEARFRAC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerYEARFRAC()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/YEARFRAC.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/DateTime/YEARFRAC.data');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,502 +15,502 @@ class FinancialTest extends PHPUnit_Framework_TestCase
|
|||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerACCRINT
|
||||
*/
|
||||
public function testACCRINT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testACCRINT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerACCRINT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerACCRINTM
|
||||
*/
|
||||
public function testACCRINTM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINTM'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testACCRINTM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINTM'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerACCRINTM()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINTM.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINTM.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerAMORDEGRC
|
||||
*/
|
||||
public function testAMORDEGRC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORDEGRC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testAMORDEGRC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORDEGRC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerAMORDEGRC()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/AMORDEGRC.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/AMORDEGRC.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerAMORLINC
|
||||
*/
|
||||
public function testAMORLINC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORLINC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testAMORLINC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORLINC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerAMORLINC()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/AMORLINC.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/AMORLINC.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCOUPDAYBS
|
||||
*/
|
||||
public function testCOUPDAYBS()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYBS'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testCOUPDAYBS()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYBS'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerCOUPDAYBS()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYBS.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYBS.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCOUPDAYS
|
||||
*/
|
||||
public function testCOUPDAYS()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYS'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testCOUPDAYS()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYS'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerCOUPDAYS()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYS.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYS.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCOUPDAYSNC
|
||||
*/
|
||||
public function testCOUPDAYSNC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYSNC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testCOUPDAYSNC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYSNC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerCOUPDAYSNC()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYSNC.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYSNC.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCOUPNCD
|
||||
*/
|
||||
public function testCOUPNCD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNCD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testCOUPNCD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNCD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerCOUPNCD()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNCD.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNCD.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCOUPNUM
|
||||
*/
|
||||
public function testCOUPNUM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNUM'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testCOUPNUM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNUM'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerCOUPNUM()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNUM.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNUM.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCOUPPCD
|
||||
*/
|
||||
public function testCOUPPCD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPPCD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testCOUPPCD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPPCD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerCOUPPCD()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPPCD.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPPCD.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCUMIPMT
|
||||
*/
|
||||
public function testCUMIPMT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMIPMT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testCUMIPMT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMIPMT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerCUMIPMT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/CUMIPMT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/CUMIPMT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCUMPRINC
|
||||
*/
|
||||
public function testCUMPRINC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMPRINC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testCUMPRINC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMPRINC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerCUMPRINC()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/CUMPRINC.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/CUMPRINC.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDB
|
||||
*/
|
||||
public function testDB()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DB'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDB()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DB'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerDB()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/DB.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/DB.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDDB
|
||||
*/
|
||||
public function testDDB()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DDB'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDDB()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DDB'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerDDB()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/DDB.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/DDB.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDISC
|
||||
*/
|
||||
public function testDISC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DISC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDISC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DISC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerDISC()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/DISC.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/DISC.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDOLLARDE
|
||||
*/
|
||||
public function testDOLLARDE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARDE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDOLLARDE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARDE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerDOLLARDE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARDE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARDE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDOLLARFR
|
||||
*/
|
||||
public function testDOLLARFR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARFR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testDOLLARFR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARFR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerDOLLARFR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARFR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARFR.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerEFFECT
|
||||
*/
|
||||
public function testEFFECT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testEFFECT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerEFFECT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/EFFECT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/EFFECT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerFV
|
||||
*/
|
||||
public function testFV()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testFV()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerFV()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/FV.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/FV.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerFVSCHEDULE
|
||||
*/
|
||||
public function testFVSCHEDULE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testFVSCHEDULE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerFVSCHEDULE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/FVSCHEDULE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/FVSCHEDULE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerINTRATE
|
||||
*/
|
||||
public function testINTRATE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testINTRATE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerINTRATE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/INTRATE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/INTRATE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIPMT
|
||||
*/
|
||||
public function testIPMT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIPMT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIPMT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/IPMT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/IPMT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIRR
|
||||
*/
|
||||
public function testIRR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIRR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIRR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/IRR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/IRR.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerISPMT
|
||||
*/
|
||||
public function testISPMT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testISPMT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerISPMT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/ISPMT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/ISPMT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerMIRR
|
||||
*/
|
||||
public function testMIRR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','MIRR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testMIRR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','MIRR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerMIRR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/MIRR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/MIRR.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerNOMINAL
|
||||
*/
|
||||
public function testNOMINAL()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NOMINAL'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testNOMINAL()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NOMINAL'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerNOMINAL()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/NOMINAL.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/NOMINAL.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerNPER
|
||||
*/
|
||||
public function testNPER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPER'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testNPER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPER'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerNPER()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/NPER.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/NPER.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerNPV
|
||||
*/
|
||||
public function testNPV()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPV'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testNPV()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPV'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerNPV()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/NPV.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/NPV.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerPRICE
|
||||
*/
|
||||
public function testPRICE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','PRICE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testPRICE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','PRICE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerPRICE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/PRICE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/PRICE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerRATE
|
||||
*/
|
||||
public function testRATE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','RATE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testRATE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','RATE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerRATE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/RATE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/RATE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerXIRR
|
||||
*/
|
||||
public function testXIRR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','XIRR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testXIRR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','XIRR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerXIRR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/XIRR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Financial/XIRR.data');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,262 +15,262 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
|||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
|
||||
}
|
||||
}
|
||||
|
||||
public function testDUMMY()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::DUMMY();
|
||||
$this->assertEquals('#Not Yet Implemented', $result);
|
||||
}
|
||||
public function testDUMMY()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::DUMMY();
|
||||
$this->assertEquals('#Not Yet Implemented', $result);
|
||||
}
|
||||
|
||||
public function testDIV0()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::DIV0();
|
||||
$this->assertEquals('#DIV/0!', $result);
|
||||
}
|
||||
public function testDIV0()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::DIV0();
|
||||
$this->assertEquals('#DIV/0!', $result);
|
||||
}
|
||||
|
||||
public function testNA()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::NA();
|
||||
$this->assertEquals('#N/A', $result);
|
||||
}
|
||||
public function testNA()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::NA();
|
||||
$this->assertEquals('#N/A', $result);
|
||||
}
|
||||
|
||||
public function testNaN()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::NaN();
|
||||
$this->assertEquals('#NUM!', $result);
|
||||
}
|
||||
public function testNaN()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::NaN();
|
||||
$this->assertEquals('#NUM!', $result);
|
||||
}
|
||||
|
||||
public function testNAME()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::NAME();
|
||||
$this->assertEquals('#NAME?', $result);
|
||||
}
|
||||
public function testNAME()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::NAME();
|
||||
$this->assertEquals('#NAME?', $result);
|
||||
}
|
||||
|
||||
public function testREF()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::REF();
|
||||
$this->assertEquals('#REF!', $result);
|
||||
}
|
||||
public function testREF()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::REF();
|
||||
$this->assertEquals('#REF!', $result);
|
||||
}
|
||||
|
||||
public function testNULL()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::NULL();
|
||||
$this->assertEquals('#NULL!', $result);
|
||||
}
|
||||
public function testNULL()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::null();
|
||||
$this->assertEquals('#NULL!', $result);
|
||||
}
|
||||
|
||||
public function testVALUE()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::VALUE();
|
||||
$this->assertEquals('#VALUE!', $result);
|
||||
}
|
||||
public function testVALUE()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Functions::VALUE();
|
||||
$this->assertEquals('#VALUE!', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIS_BLANK
|
||||
*/
|
||||
public function testIS_BLANK()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_BLANK'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIS_BLANK()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_BLANK'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIS_BLANK()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_BLANK.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_BLANK.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIS_ERR
|
||||
*/
|
||||
public function testIS_ERR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIS_ERR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIS_ERR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ERR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ERR.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIS_ERROR
|
||||
*/
|
||||
public function testIS_ERROR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERROR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIS_ERROR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERROR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIS_ERROR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ERROR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ERROR.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerERROR_TYPE
|
||||
*/
|
||||
public function testERROR_TYPE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','ERROR_TYPE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testERROR_TYPE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','ERROR_TYPE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerERROR_TYPE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/ERROR_TYPE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/ERROR_TYPE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIS_LOGICAL
|
||||
*/
|
||||
public function testIS_LOGICAL()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_LOGICAL'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIS_LOGICAL()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_LOGICAL'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIS_LOGICAL()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_LOGICAL.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_LOGICAL.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIS_NA
|
||||
*/
|
||||
public function testIS_NA()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NA'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIS_NA()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NA'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIS_NA()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NA.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NA.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIS_NUMBER
|
||||
*/
|
||||
public function testIS_NUMBER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NUMBER'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIS_NUMBER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NUMBER'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIS_NUMBER()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NUMBER.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NUMBER.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIS_TEXT
|
||||
*/
|
||||
public function testIS_TEXT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_TEXT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIS_TEXT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_TEXT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIS_TEXT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_TEXT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_TEXT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIS_NONTEXT
|
||||
*/
|
||||
public function testIS_NONTEXT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NONTEXT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIS_NONTEXT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NONTEXT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIS_NONTEXT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NONTEXT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NONTEXT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIS_EVEN
|
||||
*/
|
||||
public function testIS_EVEN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_EVEN'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIS_EVEN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_EVEN'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIS_EVEN()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_EVEN.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_EVEN.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIS_ODD
|
||||
*/
|
||||
public function testIS_ODD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ODD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testIS_ODD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ODD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerIS_ODD()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ODD.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ODD.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerTYPE
|
||||
*/
|
||||
public function testTYPE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','TYPE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testTYPE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','TYPE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerTYPE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/TYPE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/TYPE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerN
|
||||
*/
|
||||
public function testN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','N'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
public function testN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','N'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerN()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/N.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Functions/N.data');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,98 +15,98 @@ class LogicalTest extends PHPUnit_Framework_TestCase
|
|||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
|
||||
}
|
||||
}
|
||||
|
||||
public function testTRUE()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Logical::TRUE();
|
||||
$this->assertEquals(TRUE, $result);
|
||||
}
|
||||
public function testTRUE()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Logical::TRUE();
|
||||
$this->assertEquals(true, $result);
|
||||
}
|
||||
|
||||
public function testFALSE()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Logical::FALSE();
|
||||
$this->assertEquals(FALSE, $result);
|
||||
}
|
||||
public function testFALSE()
|
||||
{
|
||||
$result = PHPExcel_Calculation_Logical::FALSE();
|
||||
$this->assertEquals(false, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerAND
|
||||
*/
|
||||
public function testAND()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_AND'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testAND()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_AND'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerAND()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Logical/AND.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Logical/AND.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerOR
|
||||
*/
|
||||
public function testOR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_OR'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testOR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_OR'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerOR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Logical/OR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Logical/OR.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerNOT
|
||||
*/
|
||||
public function testNOT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','NOT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','NOT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerNOT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Logical/NOT.data');
|
||||
return new testDataFileIterator('rawTestData/Calculation/Logical/NOT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIF
|
||||
*/
|
||||
public function testIF()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','STATEMENT_IF'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','STATEMENT_IF'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerIF()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Logical/IF.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/Logical/IF.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerIFERROR
|
||||
*/
|
||||
public function testIFERROR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','IFERROR'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','IFERROR'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerIFERROR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/Logical/IFERROR.data');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,38 +15,38 @@ class LookupRefTest extends PHPUnit_Framework_TestCase
|
|||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerHLOOKUP
|
||||
*/
|
||||
public function testHLOOKUP()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','HLOOKUP'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testHLOOKUP()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','HLOOKUP'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerHLOOKUP()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/LookupRef/HLOOKUP.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/LookupRef/HLOOKUP.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerVLOOKUP
|
||||
*/
|
||||
public function testVLOOKUP()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','VLOOKUP'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testVLOOKUP()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','VLOOKUP'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerVLOOKUP()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/LookupRef/VLOOKUP.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/LookupRef/VLOOKUP.data');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,472 +15,472 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
|
|||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerATAN2
|
||||
*/
|
||||
public function testATAN2()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testATAN2()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerATAN2()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ATAN2.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ATAN2.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCEILING
|
||||
*/
|
||||
public function testCEILING()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testCEILING()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerCEILING()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/CEILING.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/CEILING.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCOMBIN
|
||||
*/
|
||||
public function testCOMBIN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testCOMBIN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerCOMBIN()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/COMBIN.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/COMBIN.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerEVEN
|
||||
*/
|
||||
public function testEVEN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testEVEN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerEVEN()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/EVEN.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/EVEN.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerODD
|
||||
*/
|
||||
public function testODD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testODD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerODD()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ODD.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ODD.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerFACT
|
||||
*/
|
||||
public function testFACT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testFACT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerFACT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerFACTDOUBLE
|
||||
*/
|
||||
public function testFACTDOUBLE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testFACTDOUBLE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerFACTDOUBLE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACTDOUBLE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACTDOUBLE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerFLOOR
|
||||
*/
|
||||
public function testFLOOR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testFLOOR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerFLOOR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FLOOR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FLOOR.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerGCD
|
||||
*/
|
||||
public function testGCD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testGCD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerGCD()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/GCD.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/GCD.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerLCM
|
||||
*/
|
||||
public function testLCM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testLCM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerLCM()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/LCM.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/LCM.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerINT
|
||||
*/
|
||||
public function testINT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','INT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testINT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','INT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerINT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/INT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/INT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerSIGN
|
||||
*/
|
||||
public function testSIGN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testSIGN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerSIGN()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SIGN.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SIGN.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerPOWER
|
||||
*/
|
||||
public function testPOWER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testPOWER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerPOWER()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/POWER.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/POWER.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerLOG
|
||||
*/
|
||||
public function testLOG()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testLOG()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerLOG()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/LOG.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/LOG.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerMOD
|
||||
*/
|
||||
public function testMOD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testMOD()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerMOD()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MOD.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MOD.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerMDETERM
|
||||
*/
|
||||
public function testMDETERM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testMDETERM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerMDETERM()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MDETERM.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MDETERM.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerMINVERSE
|
||||
*/
|
||||
public function testMINVERSE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testMINVERSE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerMINVERSE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MINVERSE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MINVERSE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerMMULT
|
||||
*/
|
||||
public function testMMULT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testMMULT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerMMULT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MMULT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MMULT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerMULTINOMIAL
|
||||
*/
|
||||
public function testMULTINOMIAL()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testMULTINOMIAL()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerMULTINOMIAL()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MULTINOMIAL.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MULTINOMIAL.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerMROUND
|
||||
*/
|
||||
public function testMROUND()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'),$args);
|
||||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_ARRAY);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testMROUND()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'),$args);
|
||||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_ARRAY);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerMROUND()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MROUND.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MROUND.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerPRODUCT
|
||||
*/
|
||||
public function testPRODUCT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testPRODUCT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerPRODUCT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/PRODUCT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/PRODUCT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerQUOTIENT
|
||||
*/
|
||||
public function testQUOTIENT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testQUOTIENT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerQUOTIENT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/QUOTIENT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/QUOTIENT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerROUNDUP
|
||||
*/
|
||||
public function testROUNDUP()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testROUNDUP()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerROUNDUP()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDUP.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDUP.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerROUNDDOWN
|
||||
*/
|
||||
public function testROUNDDOWN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testROUNDDOWN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerROUNDDOWN()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDDOWN.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDDOWN.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerSERIESSUM
|
||||
*/
|
||||
public function testSERIESSUM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testSERIESSUM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerSERIESSUM()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SERIESSUM.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SERIESSUM.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerSUMSQ
|
||||
*/
|
||||
public function testSUMSQ()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testSUMSQ()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerSUMSQ()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SUMSQ.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SUMSQ.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerTRUNC
|
||||
*/
|
||||
public function testTRUNC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testTRUNC()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerTRUNC()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/TRUNC.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/TRUNC.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerROMAN
|
||||
*/
|
||||
public function testROMAN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROMAN'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testROMAN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROMAN'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerROMAN()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROMAN.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROMAN.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerSQRTPI
|
||||
*/
|
||||
public function testSQRTPI()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
}
|
||||
public function testSQRTPI()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerSQRTPI()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SQRTPI.data');
|
||||
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SQRTPI.data');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -491,7 +491,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
|
|||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig', 'SUMIF'), $args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||
}
|
||||
|
||||
public function providerSUMIF()
|
||||
|
@ -555,6 +555,6 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
|
|||
100
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,351 +15,351 @@ class TextDataTest extends PHPUnit_Framework_TestCase
|
|||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCHAR
|
||||
*/
|
||||
public function testCHAR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CHARACTER'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testCHAR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CHARACTER'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerCHAR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/CHAR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/CHAR.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCODE
|
||||
*/
|
||||
public function testCODE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','ASCIICODE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testCODE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','ASCIICODE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerCODE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/CODE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/CODE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCONCATENATE
|
||||
*/
|
||||
public function testCONCATENATE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CONCATENATE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testCONCATENATE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CONCATENATE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerCONCATENATE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/CONCATENATE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/CONCATENATE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerLEFT
|
||||
*/
|
||||
public function testLEFT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LEFT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testLEFT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LEFT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerLEFT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/LEFT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/LEFT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerMID
|
||||
*/
|
||||
public function testMID()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','MID'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testMID()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','MID'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerMID()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/MID.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/MID.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerRIGHT
|
||||
*/
|
||||
public function testRIGHT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RIGHT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testRIGHT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RIGHT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerRIGHT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/RIGHT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/RIGHT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerLOWER
|
||||
*/
|
||||
public function testLOWER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LOWERCASE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testLOWER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LOWERCASE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerLOWER()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/LOWER.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/LOWER.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerUPPER
|
||||
*/
|
||||
public function testUPPER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','UPPERCASE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testUPPER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','UPPERCASE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerUPPER()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/UPPER.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/UPPER.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerPROPER
|
||||
*/
|
||||
public function testPROPER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','PROPERCASE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testPROPER()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','PROPERCASE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerPROPER()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/PROPER.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/PROPER.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerLEN
|
||||
*/
|
||||
public function testLEN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','STRINGLENGTH'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testLEN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','STRINGLENGTH'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerLEN()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/LEN.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/LEN.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerSEARCH
|
||||
*/
|
||||
public function testSEARCH()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHINSENSITIVE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testSEARCH()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHINSENSITIVE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerSEARCH()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/SEARCH.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/SEARCH.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerFIND
|
||||
*/
|
||||
public function testFIND()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHSENSITIVE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testFIND()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHSENSITIVE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerFIND()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/FIND.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/FIND.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerREPLACE
|
||||
*/
|
||||
public function testREPLACE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','REPLACE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testREPLACE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','REPLACE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerREPLACE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/REPLACE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/REPLACE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerSUBSTITUTE
|
||||
*/
|
||||
public function testSUBSTITUTE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SUBSTITUTE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testSUBSTITUTE()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SUBSTITUTE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerSUBSTITUTE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/SUBSTITUTE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/SUBSTITUTE.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerTRIM
|
||||
*/
|
||||
public function testTRIM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMSPACES'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testTRIM()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMSPACES'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerTRIM()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/TRIM.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/TRIM.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCLEAN
|
||||
*/
|
||||
public function testCLEAN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMNONPRINTABLE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testCLEAN()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMNONPRINTABLE'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerCLEAN()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/CLEAN.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/CLEAN.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerDOLLAR
|
||||
*/
|
||||
public function testDOLLAR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','DOLLAR'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testDOLLAR()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','DOLLAR'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerDOLLAR()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/DOLLAR.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/DOLLAR.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerFIXED
|
||||
*/
|
||||
public function testFIXED()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','FIXEDFORMAT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testFIXED()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','FIXEDFORMAT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerFIXED()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/FIXED.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/FIXED.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerT
|
||||
*/
|
||||
public function testT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RETURNSTRING'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testT()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RETURNSTRING'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/T.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/T.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerTEXT
|
||||
*/
|
||||
public function testTEXT()
|
||||
{
|
||||
// Enforce decimal and thousands separator values to UK/US, and currency code to USD
|
||||
call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.');
|
||||
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),',');
|
||||
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');
|
||||
public function testTEXT()
|
||||
{
|
||||
// Enforce decimal and thousands separator values to UK/US, and currency code to USD
|
||||
call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.');
|
||||
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),',');
|
||||
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');
|
||||
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TEXTFORMAT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TEXTFORMAT'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerTEXT()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/TEXT.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/TEXT.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerVALUE
|
||||
*/
|
||||
public function testVALUE()
|
||||
{
|
||||
call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.');
|
||||
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),' ');
|
||||
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');
|
||||
public function testVALUE()
|
||||
{
|
||||
call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.');
|
||||
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),' ');
|
||||
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');
|
||||
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','VALUE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
|
||||
}
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','VALUE'),$args);
|
||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||
}
|
||||
|
||||
public function providerVALUE()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/VALUE.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Calculation/TextData/VALUE.data');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,12 +36,12 @@ class AdvancedValueBinderTest extends PHPUnit_Framework_TestCase
|
|||
public function testCurrency($value, $valueBinded, $format, $thousandsSeparator, $decimalSeparator, $currencyCode)
|
||||
{
|
||||
$sheet = $this->getMock(
|
||||
'PHPExcel_Worksheet',
|
||||
array('getStyle', 'getNumberFormat', 'setFormatCode','getCellCacheController')
|
||||
);
|
||||
'PHPExcel_Worksheet',
|
||||
array('getStyle', 'getNumberFormat', 'setFormatCode','getCellCacheController')
|
||||
);
|
||||
$cache = $this->getMockBuilder('PHPExcel_CachedObjectStorage_Memory')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$cache->expects($this->any())
|
||||
->method('getParent')
|
||||
->will($this->returnValue($sheet));
|
||||
|
@ -64,7 +64,7 @@ class AdvancedValueBinderTest extends PHPUnit_Framework_TestCase
|
|||
PHPExcel_Shared_String::setDecimalSeparator($decimalSeparator);
|
||||
PHPExcel_Shared_String::setThousandsSeparator($thousandsSeparator);
|
||||
|
||||
$cell = new PHPExcel_Cell(NULL, PHPExcel_Cell_DataType::TYPE_STRING, $sheet);
|
||||
$cell = new PHPExcel_Cell(null, PHPExcel_Cell_DataType::TYPE_STRING, $sheet);
|
||||
|
||||
$binder = new PHPExcel_Cell_AdvancedValueBinder();
|
||||
$binder->bindValue($cell, $value);
|
||||
|
|
|
@ -11,14 +11,14 @@ class DataTypeTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetErrorCodes()
|
||||
{
|
||||
$result = call_user_func(array('PHPExcel_Cell_DataType','getErrorCodes'));
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertGreaterThan(0, count($result));
|
||||
$this->assertArrayHasKey('#NULL!', $result);
|
||||
}
|
||||
public function testGetErrorCodes()
|
||||
{
|
||||
$result = call_user_func(array('PHPExcel_Cell_DataType','getErrorCodes'));
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertGreaterThan(0, count($result));
|
||||
$this->assertArrayHasKey('#NULL!', $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
protected function createCellStub()
|
||||
{
|
||||
|
@ -32,12 +32,12 @@ class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
|
|||
* @dataProvider binderProvider
|
||||
*/
|
||||
public function testBindValue($value)
|
||||
{
|
||||
$this->createCellStub();
|
||||
{
|
||||
$this->createCellStub();
|
||||
$binder = new PHPExcel_Cell_DefaultValueBinder();
|
||||
$result = $binder->bindValue($this->cellStub, $value);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
$result = $binder->bindValue($this->cellStub, $value);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function binderProvider()
|
||||
{
|
||||
|
@ -60,26 +60,26 @@ class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @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 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');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Cell/DefaultValueBinder.data');
|
||||
}
|
||||
|
||||
public function testDataTypeForRichTextObject()
|
||||
{
|
||||
public function testDataTypeForRichTextObject()
|
||||
{
|
||||
$objRichText = new PHPExcel_RichText();
|
||||
$objRichText->createText('Hello World');
|
||||
|
||||
$expectedResult = PHPExcel_Cell_DataType::TYPE_INLINE;
|
||||
$result = call_user_func(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $objRichText);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
$result = call_user_func(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $objRichText);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,78 +11,78 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetUrl()
|
||||
{
|
||||
$urlValue = 'http://www.phpexcel.net';
|
||||
public function testGetUrl()
|
||||
{
|
||||
$urlValue = 'http://www.phpexcel.net';
|
||||
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink($urlValue);
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink($urlValue);
|
||||
|
||||
$result = $testInstance->getUrl();
|
||||
$this->assertEquals($urlValue,$result);
|
||||
}
|
||||
$result = $testInstance->getUrl();
|
||||
$this->assertEquals($urlValue,$result);
|
||||
}
|
||||
|
||||
public function testSetUrl()
|
||||
{
|
||||
$initialUrlValue = 'http://www.phpexcel.net';
|
||||
$newUrlValue = 'http://github.com/PHPOffice/PHPExcel';
|
||||
public function testSetUrl()
|
||||
{
|
||||
$initialUrlValue = 'http://www.phpexcel.net';
|
||||
$newUrlValue = 'http://github.com/PHPOffice/PHPExcel';
|
||||
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue);
|
||||
$result = $testInstance->setUrl($newUrlValue);
|
||||
$this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue);
|
||||
$result = $testInstance->setUrl($newUrlValue);
|
||||
$this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
|
||||
|
||||
$result = $testInstance->getUrl();
|
||||
$this->assertEquals($newUrlValue,$result);
|
||||
}
|
||||
$result = $testInstance->getUrl();
|
||||
$this->assertEquals($newUrlValue,$result);
|
||||
}
|
||||
|
||||
public function testGetTooltip()
|
||||
{
|
||||
$tooltipValue = 'PHPExcel Web Site';
|
||||
public function testGetTooltip()
|
||||
{
|
||||
$tooltipValue = 'PHPExcel Web Site';
|
||||
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink(NULL, $tooltipValue);
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink(null, $tooltipValue);
|
||||
|
||||
$result = $testInstance->getTooltip();
|
||||
$this->assertEquals($tooltipValue,$result);
|
||||
}
|
||||
$result = $testInstance->getTooltip();
|
||||
$this->assertEquals($tooltipValue,$result);
|
||||
}
|
||||
|
||||
public function testSetTooltip()
|
||||
{
|
||||
$initialTooltipValue = 'PHPExcel Web Site';
|
||||
$newTooltipValue = 'PHPExcel Repository on Github';
|
||||
public function testSetTooltip()
|
||||
{
|
||||
$initialTooltipValue = 'PHPExcel Web Site';
|
||||
$newTooltipValue = 'PHPExcel Repository on Github';
|
||||
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink(NULL, $initialTooltipValue);
|
||||
$result = $testInstance->setTooltip($newTooltipValue);
|
||||
$this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink(null, $initialTooltipValue);
|
||||
$result = $testInstance->setTooltip($newTooltipValue);
|
||||
$this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
|
||||
|
||||
$result = $testInstance->getTooltip();
|
||||
$this->assertEquals($newTooltipValue,$result);
|
||||
}
|
||||
$result = $testInstance->getTooltip();
|
||||
$this->assertEquals($newTooltipValue,$result);
|
||||
}
|
||||
|
||||
public function testIsInternal()
|
||||
{
|
||||
$initialUrlValue = 'http://www.phpexcel.net';
|
||||
$newUrlValue = 'sheet://Worksheet1!A1';
|
||||
public function testIsInternal()
|
||||
{
|
||||
$initialUrlValue = 'http://www.phpexcel.net';
|
||||
$newUrlValue = 'sheet://Worksheet1!A1';
|
||||
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue);
|
||||
$result = $testInstance->isInternal();
|
||||
$this->assertFalse($result);
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue);
|
||||
$result = $testInstance->isInternal();
|
||||
$this->assertFalse($result);
|
||||
|
||||
$testInstance->setUrl($newUrlValue);
|
||||
$result = $testInstance->isInternal();
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
$testInstance->setUrl($newUrlValue);
|
||||
$result = $testInstance->isInternal();
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testGetHashCode()
|
||||
{
|
||||
$urlValue = 'http://www.phpexcel.net';
|
||||
$tooltipValue = 'PHPExcel Web Site';
|
||||
$initialExpectedHash = 'd84d713aed1dbbc8a7c5af183d6c7dbb';
|
||||
public function testGetHashCode()
|
||||
{
|
||||
$urlValue = 'http://www.phpexcel.net';
|
||||
$tooltipValue = 'PHPExcel Web Site';
|
||||
$initialExpectedHash = 'd84d713aed1dbbc8a7c5af183d6c7dbb';
|
||||
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink($urlValue, $tooltipValue);
|
||||
$testInstance = new PHPExcel_Cell_Hyperlink($urlValue, $tooltipValue);
|
||||
|
||||
$result = $testInstance->getHashCode();
|
||||
$this->assertEquals($initialExpectedHash,$result);
|
||||
}
|
||||
$result = $testInstance->getHashCode();
|
||||
$this->assertEquals($initialExpectedHash,$result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,284 +12,284 @@ class CellTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerColumnString
|
||||
*/
|
||||
public function testColumnIndexFromString()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','columnIndexFromString'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testColumnIndexFromString()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','columnIndexFromString'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerColumnString()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/ColumnString.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/ColumnString.data');
|
||||
}
|
||||
|
||||
public function testColumnIndexFromStringTooLong()
|
||||
{
|
||||
$cellAddress = 'ABCD';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
{
|
||||
$cellAddress = 'ABCD';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
|
||||
public function testColumnIndexFromStringTooShort()
|
||||
{
|
||||
$cellAddress = '';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Column string index can not be empty');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
{
|
||||
$cellAddress = '';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Column string index can not be empty');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerColumnIndex
|
||||
*/
|
||||
public function testStringFromColumnIndex()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','stringFromColumnIndex'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testStringFromColumnIndex()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','stringFromColumnIndex'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerColumnIndex()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/ColumnIndex.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/ColumnIndex.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerCoordinates
|
||||
*/
|
||||
public function testCoordinateFromString()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','coordinateFromString'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testCoordinateFromString()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','coordinateFromString'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerCoordinates()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/CellCoordinates.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/CellCoordinates.data');
|
||||
}
|
||||
|
||||
public function testCoordinateFromStringWithRangeAddress()
|
||||
{
|
||||
$cellAddress = 'A1:AI2012';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
{
|
||||
$cellAddress = 'A1:AI2012';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
|
||||
public function testCoordinateFromStringWithEmptyAddress()
|
||||
{
|
||||
$cellAddress = '';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
{
|
||||
$cellAddress = '';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
|
||||
public function testCoordinateFromStringWithInvalidAddress()
|
||||
{
|
||||
$cellAddress = 'AI';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Invalid cell coordinate '.$cellAddress);
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
{
|
||||
$cellAddress = 'AI';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Invalid cell coordinate '.$cellAddress);
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerAbsoluteCoordinates
|
||||
*/
|
||||
public function testAbsoluteCoordinateFromString()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','absoluteCoordinate'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testAbsoluteCoordinateFromString()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','absoluteCoordinate'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerAbsoluteCoordinates()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/CellAbsoluteCoordinate.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/CellAbsoluteCoordinate.data');
|
||||
}
|
||||
|
||||
public function testAbsoluteCoordinateFromStringWithRangeAddress()
|
||||
{
|
||||
$cellAddress = 'A1:AI2012';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','absoluteCoordinate'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
{
|
||||
$cellAddress = 'A1:AI2012';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','absoluteCoordinate'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerAbsoluteReferences
|
||||
*/
|
||||
public function testAbsoluteReferenceFromString()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','absoluteReference'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testAbsoluteReferenceFromString()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','absoluteReference'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerAbsoluteReferences()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/CellAbsoluteReference.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/CellAbsoluteReference.data');
|
||||
}
|
||||
|
||||
public function testAbsoluteReferenceFromStringWithRangeAddress()
|
||||
{
|
||||
$cellAddress = 'A1:AI2012';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','absoluteReference'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
{
|
||||
$cellAddress = 'A1:AI2012';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','absoluteReference'),$cellAddress);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerSplitRange
|
||||
*/
|
||||
public function testSplitRange()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','splitRange'),$args);
|
||||
foreach($result as $key => $split) {
|
||||
if (!is_array($expectedResult[$key])) {
|
||||
$this->assertEquals($expectedResult[$key], $split[0]);
|
||||
} else {
|
||||
$this->assertEquals($expectedResult[$key], $split);
|
||||
}
|
||||
}
|
||||
}
|
||||
public function testSplitRange()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','splitRange'),$args);
|
||||
foreach ($result as $key => $split) {
|
||||
if (!is_array($expectedResult[$key])) {
|
||||
$this->assertEquals($expectedResult[$key], $split[0]);
|
||||
} else {
|
||||
$this->assertEquals($expectedResult[$key], $split);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function providerSplitRange()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/CellSplitRange.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/CellSplitRange.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerBuildRange
|
||||
*/
|
||||
public function testBuildRange()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','buildRange'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testBuildRange()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','buildRange'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerBuildRange()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/CellBuildRange.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/CellBuildRange.data');
|
||||
}
|
||||
|
||||
public function testBuildRangeInvalid()
|
||||
{
|
||||
$cellRange = '';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','buildRange'),$cellRange);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Range does not contain any information');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
{
|
||||
$cellRange = '';
|
||||
try {
|
||||
$result = call_user_func(array('PHPExcel_Cell','buildRange'),$cellRange);
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Range does not contain any information');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerRangeBoundaries
|
||||
*/
|
||||
public function testRangeBoundaries()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','rangeBoundaries'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testRangeBoundaries()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','rangeBoundaries'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerRangeBoundaries()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/CellRangeBoundaries.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/CellRangeBoundaries.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerRangeDimension
|
||||
*/
|
||||
public function testRangeDimension()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','rangeDimension'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testRangeDimension()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','rangeDimension'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerRangeDimension()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/CellRangeDimension.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/CellRangeDimension.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerGetRangeBoundaries
|
||||
*/
|
||||
public function testGetRangeBoundaries()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','getRangeBoundaries'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testGetRangeBoundaries()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','getRangeBoundaries'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerGetRangeBoundaries()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/CellGetRangeBoundaries.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/CellGetRangeBoundaries.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerExtractAllCellReferencesInRange
|
||||
*/
|
||||
public function testExtractAllCellReferencesInRange()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','extractAllCellReferencesInRange'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testExtractAllCellReferencesInRange()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Cell','extractAllCellReferencesInRange'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerExtractAllCellReferencesInRange()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/CellExtractAllCellReferencesInRange.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/CellExtractAllCellReferencesInRange.data');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,45 +11,45 @@ class DataSeriesValuesTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function testSetDataType()
|
||||
{
|
||||
$dataTypeValues = array(
|
||||
'Number',
|
||||
'String'
|
||||
);
|
||||
public function testSetDataType()
|
||||
{
|
||||
$dataTypeValues = array(
|
||||
'Number',
|
||||
'String'
|
||||
);
|
||||
|
||||
$testInstance = new PHPExcel_Chart_DataSeriesValues;
|
||||
$testInstance = new PHPExcel_Chart_DataSeriesValues;
|
||||
|
||||
foreach($dataTypeValues as $dataTypeValue) {
|
||||
$result = $testInstance->setDataType($dataTypeValue);
|
||||
$this->assertTrue($result instanceof PHPExcel_Chart_DataSeriesValues);
|
||||
}
|
||||
}
|
||||
foreach ($dataTypeValues as $dataTypeValue) {
|
||||
$result = $testInstance->setDataType($dataTypeValue);
|
||||
$this->assertTrue($result instanceof PHPExcel_Chart_DataSeriesValues);
|
||||
}
|
||||
}
|
||||
|
||||
public function testSetInvalidDataTypeThrowsException()
|
||||
{
|
||||
$testInstance = new PHPExcel_Chart_DataSeriesValues;
|
||||
public function testSetInvalidDataTypeThrowsException()
|
||||
{
|
||||
$testInstance = new PHPExcel_Chart_DataSeriesValues;
|
||||
|
||||
try {
|
||||
$result = $testInstance->setDataType('BOOLEAN');
|
||||
} catch (Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Invalid datatype for chart data series values');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
try {
|
||||
$result = $testInstance->setDataType('BOOLEAN');
|
||||
} catch (Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), 'Invalid datatype for chart data series values');
|
||||
return;
|
||||
}
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
}
|
||||
|
||||
public function testGetDataType()
|
||||
{
|
||||
$dataTypeValue = 'String';
|
||||
public function testGetDataType()
|
||||
{
|
||||
$dataTypeValue = 'String';
|
||||
|
||||
$testInstance = new PHPExcel_Chart_DataSeriesValues;
|
||||
$setValue = $testInstance->setDataType($dataTypeValue);
|
||||
$testInstance = new PHPExcel_Chart_DataSeriesValues;
|
||||
$setValue = $testInstance->setDataType($dataTypeValue);
|
||||
|
||||
$result = $testInstance->getDataType();
|
||||
$this->assertEquals($dataTypeValue,$result);
|
||||
}
|
||||
$result = $testInstance->getDataType();
|
||||
$this->assertEquals($dataTypeValue,$result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,27 +11,27 @@ class LayoutTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function testSetLayoutTarget()
|
||||
{
|
||||
$LayoutTargetValue = 'String';
|
||||
public function testSetLayoutTarget()
|
||||
{
|
||||
$LayoutTargetValue = 'String';
|
||||
|
||||
$testInstance = new PHPExcel_Chart_Layout;
|
||||
$testInstance = new PHPExcel_Chart_Layout;
|
||||
|
||||
$result = $testInstance->setLayoutTarget($LayoutTargetValue);
|
||||
$this->assertTrue($result instanceof PHPExcel_Chart_Layout);
|
||||
}
|
||||
$result = $testInstance->setLayoutTarget($LayoutTargetValue);
|
||||
$this->assertTrue($result instanceof PHPExcel_Chart_Layout);
|
||||
}
|
||||
|
||||
public function testGetLayoutTarget()
|
||||
{
|
||||
$LayoutTargetValue = 'String';
|
||||
public function testGetLayoutTarget()
|
||||
{
|
||||
$LayoutTargetValue = 'String';
|
||||
|
||||
$testInstance = new PHPExcel_Chart_Layout;
|
||||
$setValue = $testInstance->setLayoutTarget($LayoutTargetValue);
|
||||
$testInstance = new PHPExcel_Chart_Layout;
|
||||
$setValue = $testInstance->setLayoutTarget($LayoutTargetValue);
|
||||
|
||||
$result = $testInstance->getLayoutTarget();
|
||||
$this->assertEquals($LayoutTargetValue,$result);
|
||||
}
|
||||
$result = $testInstance->getLayoutTarget();
|
||||
$this->assertEquals($LayoutTargetValue,$result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,124 +11,124 @@ class LegendTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function testSetPosition()
|
||||
{
|
||||
$positionValues = array(
|
||||
PHPExcel_Chart_Legend::POSITION_RIGHT,
|
||||
PHPExcel_Chart_Legend::POSITION_LEFT,
|
||||
PHPExcel_Chart_Legend::POSITION_TOP,
|
||||
PHPExcel_Chart_Legend::POSITION_BOTTOM,
|
||||
PHPExcel_Chart_Legend::POSITION_TOPRIGHT,
|
||||
);
|
||||
public function testSetPosition()
|
||||
{
|
||||
$positionValues = array(
|
||||
PHPExcel_Chart_Legend::POSITION_RIGHT,
|
||||
PHPExcel_Chart_Legend::POSITION_LEFT,
|
||||
PHPExcel_Chart_Legend::POSITION_TOP,
|
||||
PHPExcel_Chart_Legend::POSITION_BOTTOM,
|
||||
PHPExcel_Chart_Legend::POSITION_TOPRIGHT,
|
||||
);
|
||||
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
|
||||
foreach($positionValues as $positionValue) {
|
||||
$result = $testInstance->setPosition($positionValue);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
foreach ($positionValues as $positionValue) {
|
||||
$result = $testInstance->setPosition($positionValue);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
|
||||
public function testSetInvalidPositionReturnsFalse()
|
||||
{
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
public function testSetInvalidPositionReturnsFalse()
|
||||
{
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
|
||||
$result = $testInstance->setPosition('BottomLeft');
|
||||
$this->assertFalse($result);
|
||||
// Ensure that value is unchanged
|
||||
$result = $testInstance->getPosition();
|
||||
$this->assertEquals(PHPExcel_Chart_Legend::POSITION_RIGHT,$result);
|
||||
}
|
||||
$result = $testInstance->setPosition('BottomLeft');
|
||||
$this->assertFalse($result);
|
||||
// Ensure that value is unchanged
|
||||
$result = $testInstance->getPosition();
|
||||
$this->assertEquals(PHPExcel_Chart_Legend::POSITION_RIGHT,$result);
|
||||
}
|
||||
|
||||
public function testGetPosition()
|
||||
{
|
||||
$PositionValue = PHPExcel_Chart_Legend::POSITION_BOTTOM;
|
||||
public function testGetPosition()
|
||||
{
|
||||
$PositionValue = PHPExcel_Chart_Legend::POSITION_BOTTOM;
|
||||
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
$setValue = $testInstance->setPosition($PositionValue);
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
$setValue = $testInstance->setPosition($PositionValue);
|
||||
|
||||
$result = $testInstance->getPosition();
|
||||
$this->assertEquals($PositionValue,$result);
|
||||
}
|
||||
$result = $testInstance->getPosition();
|
||||
$this->assertEquals($PositionValue,$result);
|
||||
}
|
||||
|
||||
public function testSetPositionXL()
|
||||
{
|
||||
$positionValues = array(
|
||||
PHPExcel_Chart_Legend::xlLegendPositionBottom,
|
||||
PHPExcel_Chart_Legend::xlLegendPositionCorner,
|
||||
PHPExcel_Chart_Legend::xlLegendPositionCustom,
|
||||
PHPExcel_Chart_Legend::xlLegendPositionLeft,
|
||||
PHPExcel_Chart_Legend::xlLegendPositionRight,
|
||||
PHPExcel_Chart_Legend::xlLegendPositionTop,
|
||||
);
|
||||
public function testSetPositionXL()
|
||||
{
|
||||
$positionValues = array(
|
||||
PHPExcel_Chart_Legend::xlLegendPositionBottom,
|
||||
PHPExcel_Chart_Legend::xlLegendPositionCorner,
|
||||
PHPExcel_Chart_Legend::xlLegendPositionCustom,
|
||||
PHPExcel_Chart_Legend::xlLegendPositionLeft,
|
||||
PHPExcel_Chart_Legend::xlLegendPositionRight,
|
||||
PHPExcel_Chart_Legend::xlLegendPositionTop,
|
||||
);
|
||||
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
|
||||
foreach($positionValues as $positionValue) {
|
||||
$result = $testInstance->setPositionXL($positionValue);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
foreach ($positionValues as $positionValue) {
|
||||
$result = $testInstance->setPositionXL($positionValue);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
|
||||
public function testSetInvalidXLPositionReturnsFalse()
|
||||
{
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
public function testSetInvalidXLPositionReturnsFalse()
|
||||
{
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
|
||||
$result = $testInstance->setPositionXL(999);
|
||||
$this->assertFalse($result);
|
||||
// Ensure that value is unchanged
|
||||
$result = $testInstance->getPositionXL();
|
||||
$this->assertEquals(PHPExcel_Chart_Legend::xlLegendPositionRight,$result);
|
||||
}
|
||||
$result = $testInstance->setPositionXL(999);
|
||||
$this->assertFalse($result);
|
||||
// Ensure that value is unchanged
|
||||
$result = $testInstance->getPositionXL();
|
||||
$this->assertEquals(PHPExcel_Chart_Legend::xlLegendPositionRight,$result);
|
||||
}
|
||||
|
||||
public function testGetPositionXL()
|
||||
{
|
||||
$PositionValue = PHPExcel_Chart_Legend::xlLegendPositionCorner;
|
||||
public function testGetPositionXL()
|
||||
{
|
||||
$PositionValue = PHPExcel_Chart_Legend::xlLegendPositionCorner;
|
||||
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
$setValue = $testInstance->setPositionXL($PositionValue);
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
$setValue = $testInstance->setPositionXL($PositionValue);
|
||||
|
||||
$result = $testInstance->getPositionXL();
|
||||
$this->assertEquals($PositionValue,$result);
|
||||
}
|
||||
$result = $testInstance->getPositionXL();
|
||||
$this->assertEquals($PositionValue,$result);
|
||||
}
|
||||
|
||||
public function testSetOverlay()
|
||||
{
|
||||
$overlayValues = array(
|
||||
TRUE,
|
||||
FALSE,
|
||||
);
|
||||
public function testSetOverlay()
|
||||
{
|
||||
$overlayValues = array(
|
||||
true,
|
||||
false,
|
||||
);
|
||||
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
|
||||
foreach($overlayValues as $overlayValue) {
|
||||
$result = $testInstance->setOverlay($overlayValue);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
foreach ($overlayValues as $overlayValue) {
|
||||
$result = $testInstance->setOverlay($overlayValue);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
|
||||
public function testSetInvalidOverlayReturnsFalse()
|
||||
{
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
public function testSetInvalidOverlayReturnsFalse()
|
||||
{
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
|
||||
$result = $testInstance->setOverlay('INVALID');
|
||||
$this->assertFalse($result);
|
||||
$result = $testInstance->setOverlay('INVALID');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$result = $testInstance->getOverlay();
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
$result = $testInstance->getOverlay();
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
public function testGetOverlay()
|
||||
{
|
||||
$OverlayValue = TRUE;
|
||||
public function testGetOverlay()
|
||||
{
|
||||
$OverlayValue = true;
|
||||
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
$setValue = $testInstance->setOverlay($OverlayValue);
|
||||
$testInstance = new PHPExcel_Chart_Legend;
|
||||
$setValue = $testInstance->setOverlay($OverlayValue);
|
||||
|
||||
$result = $testInstance->getOverlay();
|
||||
$this->assertEquals($OverlayValue,$result);
|
||||
}
|
||||
$result = $testInstance->getOverlay();
|
||||
$this->assertEquals($OverlayValue,$result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,46 +10,46 @@ class XEEValidatorTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerInvalidXML
|
||||
* @expectedException PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function testInvalidXML($filename)
|
||||
{
|
||||
public function testInvalidXML($filename)
|
||||
{
|
||||
$reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract');
|
||||
$expectedResult = 'FAILURE: Should throw an Exception rather than return a value';
|
||||
$result = $reader->securityScanFile($filename);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
$result = $reader->securityScanFile($filename);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerInvalidXML()
|
||||
{
|
||||
$tests = [];
|
||||
foreach(glob('rawTestData/Reader/XEETestInvalid*.xml') as $file) {
|
||||
foreach (glob('rawTestData/Reader/XEETestInvalid*.xml') as $file) {
|
||||
$tests[] = [realpath($file), true];
|
||||
}
|
||||
return $tests;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerValidXML
|
||||
*/
|
||||
public function testValidXML($filename, $expectedResult)
|
||||
{
|
||||
public function testValidXML($filename, $expectedResult)
|
||||
{
|
||||
$reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract');
|
||||
$result = $reader->securityScanFile($filename);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
$result = $reader->securityScanFile($filename);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerValidXML()
|
||||
{
|
||||
$tests = [];
|
||||
foreach(glob('rawTestData/Reader/XEETestValid*.xml') as $file) {
|
||||
foreach (glob('rawTestData/Reader/XEETestValid*.xml') as $file) {
|
||||
$tests[] = [realpath($file), file_get_contents($file)];
|
||||
}
|
||||
return $tests;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,49 +10,49 @@ class ReferenceHelperTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function testColumnSort()
|
||||
{
|
||||
$columnBase = $columnExpectedResult = array(
|
||||
'A','B','Z',
|
||||
'AA','AB','AZ',
|
||||
'BA','BB','BZ',
|
||||
'ZA','ZB','ZZ',
|
||||
'AAA','AAB','AAZ',
|
||||
'ABA','ABB','ABZ',
|
||||
'AZA','AZB','AZZ',
|
||||
'BAA','BAB','BAZ',
|
||||
'BBA','BBB','BBZ',
|
||||
'BZA','BZB','BZZ'
|
||||
);
|
||||
shuffle($columnBase);
|
||||
usort($columnBase, array('PHPExcel_ReferenceHelper','columnSort'));
|
||||
foreach($columnBase as $key => $value) {
|
||||
$this->assertEquals($columnExpectedResult[$key], $value);
|
||||
}
|
||||
}
|
||||
public function testColumnSort()
|
||||
{
|
||||
$columnBase = $columnExpectedResult = array(
|
||||
'A','B','Z',
|
||||
'AA','AB','AZ',
|
||||
'BA','BB','BZ',
|
||||
'ZA','ZB','ZZ',
|
||||
'AAA','AAB','AAZ',
|
||||
'ABA','ABB','ABZ',
|
||||
'AZA','AZB','AZZ',
|
||||
'BAA','BAB','BAZ',
|
||||
'BBA','BBB','BBZ',
|
||||
'BZA','BZB','BZZ'
|
||||
);
|
||||
shuffle($columnBase);
|
||||
usort($columnBase, array('PHPExcel_ReferenceHelper','columnSort'));
|
||||
foreach ($columnBase as $key => $value) {
|
||||
$this->assertEquals($columnExpectedResult[$key], $value);
|
||||
}
|
||||
}
|
||||
|
||||
public function testColumnReverseSort()
|
||||
{
|
||||
$columnBase = $columnExpectedResult = array(
|
||||
'A','B','Z',
|
||||
'AA','AB','AZ',
|
||||
'BA','BB','BZ',
|
||||
'ZA','ZB','ZZ',
|
||||
'AAA','AAB','AAZ',
|
||||
'ABA','ABB','ABZ',
|
||||
'AZA','AZB','AZZ',
|
||||
'BAA','BAB','BAZ',
|
||||
'BBA','BBB','BBZ',
|
||||
'BZA','BZB','BZZ'
|
||||
);
|
||||
shuffle($columnBase);
|
||||
$columnExpectedResult = array_reverse($columnExpectedResult);
|
||||
usort($columnBase, array('PHPExcel_ReferenceHelper','columnReverseSort'));
|
||||
foreach($columnBase as $key => $value) {
|
||||
$this->assertEquals($columnExpectedResult[$key], $value);
|
||||
}
|
||||
}
|
||||
public function testColumnReverseSort()
|
||||
{
|
||||
$columnBase = $columnExpectedResult = array(
|
||||
'A','B','Z',
|
||||
'AA','AB','AZ',
|
||||
'BA','BB','BZ',
|
||||
'ZA','ZB','ZZ',
|
||||
'AAA','AAB','AAZ',
|
||||
'ABA','ABB','ABZ',
|
||||
'AZA','AZB','AZZ',
|
||||
'BAA','BAB','BAZ',
|
||||
'BBA','BBB','BBZ',
|
||||
'BZA','BZB','BZZ'
|
||||
);
|
||||
shuffle($columnBase);
|
||||
$columnExpectedResult = array_reverse($columnExpectedResult);
|
||||
usort($columnBase, array('PHPExcel_ReferenceHelper','columnReverseSort'));
|
||||
foreach ($columnBase as $key => $value) {
|
||||
$this->assertEquals($columnExpectedResult[$key], $value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,46 +12,46 @@ class CodePageTest extends PHPUnit_Framework_TestCase
|
|||
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 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');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
{
|
||||
$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.');
|
||||
}
|
||||
{
|
||||
$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.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,177 +12,177 @@ class DateTest extends PHPUnit_Framework_TestCase
|
|||
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,
|
||||
);
|
||||
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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
{
|
||||
$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
|
||||
);
|
||||
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);
|
||||
}
|
||||
$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');
|
||||
}
|
||||
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
|
||||
);
|
||||
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);
|
||||
}
|
||||
$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');
|
||||
}
|
||||
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
|
||||
);
|
||||
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);
|
||||
}
|
||||
$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');
|
||||
}
|
||||
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
|
||||
);
|
||||
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);
|
||||
}
|
||||
$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');
|
||||
}
|
||||
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
|
||||
);
|
||||
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);
|
||||
}
|
||||
$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');
|
||||
}
|
||||
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 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');
|
||||
}
|
||||
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
|
||||
);
|
||||
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);
|
||||
}
|
||||
$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');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900Timezone.data');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,28 +12,28 @@ class FileTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetUseUploadTempDirectory()
|
||||
{
|
||||
$expectedResult = FALSE;
|
||||
public function testGetUseUploadTempDirectory()
|
||||
{
|
||||
$expectedResult = FALSE;
|
||||
|
||||
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testSetUseUploadTempDirectory()
|
||||
{
|
||||
$useUploadTempDirectoryValues = array(
|
||||
TRUE,
|
||||
FALSE,
|
||||
);
|
||||
public function testSetUseUploadTempDirectory()
|
||||
{
|
||||
$useUploadTempDirectoryValues = array(
|
||||
true,
|
||||
false,
|
||||
);
|
||||
|
||||
foreach($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {
|
||||
call_user_func(array('PHPExcel_Shared_File','setUseUploadTempDirectory'),$useUploadTempDirectoryValue);
|
||||
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);
|
||||
}
|
||||
}
|
||||
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
|
||||
$this->assertEquals($useUploadTempDirectoryValue, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,83 +12,83 @@ class FontTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetAutoSizeMethod()
|
||||
{
|
||||
$expectedResult = PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX;
|
||||
public function testGetAutoSizeMethod()
|
||||
{
|
||||
$expectedResult = PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX;
|
||||
|
||||
$result = call_user_func(array('PHPExcel_Shared_Font','getAutoSizeMethod'));
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
$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,
|
||||
);
|
||||
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);
|
||||
}
|
||||
}
|
||||
foreach ($autosizeMethodValues as $autosizeMethodValue) {
|
||||
$result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'),$autosizeMethodValue);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
|
||||
public function testSetAutoSizeMethodWithInvalidValue()
|
||||
{
|
||||
$unsupportedAutosizeMethod = 'guess';
|
||||
{
|
||||
$unsupportedAutosizeMethod = 'guess';
|
||||
|
||||
$result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'),$unsupportedAutosizeMethod);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
$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 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');
|
||||
}
|
||||
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 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');
|
||||
}
|
||||
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 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');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Shared/CentimeterSizeToPixels.data');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,22 +12,22 @@ class PasswordHasherTest extends PHPUnit_Framework_TestCase
|
|||
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 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');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Shared/PasswordHashes.data');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,72 +12,72 @@ class StringTest extends PHPUnit_Framework_TestCase
|
|||
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 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 testGetIsIconvEnabled()
|
||||
{
|
||||
$result = call_user_func(array('PHPExcel_Shared_String','getIsIconvEnabled'));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testGetDecimalSeparator()
|
||||
{
|
||||
$localeconv = localeconv();
|
||||
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);
|
||||
}
|
||||
$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);
|
||||
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);
|
||||
}
|
||||
$result = call_user_func(array('PHPExcel_Shared_String','getDecimalSeparator'));
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testGetThousandsSeparator()
|
||||
{
|
||||
$localeconv = localeconv();
|
||||
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);
|
||||
}
|
||||
$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);
|
||||
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);
|
||||
}
|
||||
$result = call_user_func(array('PHPExcel_Shared_String','getThousandsSeparator'));
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testGetCurrencyCode()
|
||||
{
|
||||
$localeconv = localeconv();
|
||||
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);
|
||||
}
|
||||
$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);
|
||||
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);
|
||||
}
|
||||
$result = call_user_func(array('PHPExcel_Shared_String','getCurrencyCode'));
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,30 +10,30 @@ class TimeZoneTest extends PHPUnit_Framework_TestCase
|
|||
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',
|
||||
);
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
{
|
||||
$unsupportedTimezone = 'Etc/GMT+10';
|
||||
$result = call_user_func(array('PHPExcel_Shared_TimeZone','setTimezone'),$unsupportedTimezone);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,70 +12,70 @@ class ColorTest extends PHPUnit_Framework_TestCase
|
|||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerColorGetRed
|
||||
*/
|
||||
public function testGetRed()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Style_Color','getRed'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testGetRed()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Style_Color','getRed'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerColorGetRed()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Style/ColorGetRed.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Style/ColorGetRed.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerColorGetGreen
|
||||
*/
|
||||
public function testGetGreen()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Style_Color','getGreen'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testGetGreen()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Style_Color','getGreen'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerColorGetGreen()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Style/ColorGetGreen.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Style/ColorGetGreen.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerColorGetBlue
|
||||
*/
|
||||
public function testGetBlue()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Style_Color','getBlue'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testGetBlue()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Style_Color','getBlue'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerColorGetBlue()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Style/ColorGetBlue.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Style/ColorGetBlue.data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerColorChangeBrightness
|
||||
*/
|
||||
public function testChangeBrightness()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Style_Color','changeBrightness'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testChangeBrightness()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Style_Color','changeBrightness'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerColorChangeBrightness()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Style/ColorChangeBrightness.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Style/ColorChangeBrightness.data');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,24 +13,24 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase
|
|||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
PHPExcel_Shared_String::setDecimalSeparator('.');
|
||||
PHPExcel_Shared_String::setThousandsSeparator(',');
|
||||
}
|
||||
PHPExcel_Shared_String::setDecimalSeparator('.');
|
||||
PHPExcel_Shared_String::setThousandsSeparator(',');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerNumberFormat
|
||||
*/
|
||||
public function testFormatValueWithMask()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Style_NumberFormat','toFormattedString'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
public function testFormatValueWithMask()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$expectedResult = array_pop($args);
|
||||
$result = call_user_func_array(array('PHPExcel_Style_NumberFormat','toFormattedString'),$args);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function providerNumberFormat()
|
||||
{
|
||||
return new testDataFileIterator('rawTestData/Style/NumberFormat.data');
|
||||
}
|
||||
return new testDataFileIterator('rawTestData/Style/NumberFormat.data');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
class RuleTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $_testAutoFilterRuleObject;
|
||||
private $_testAutoFilterRuleObject;
|
||||
|
||||
private $_mockAutoFilterColumnObject;
|
||||
private $_mockAutoFilterColumnObject;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
|
@ -15,95 +15,95 @@ class RuleTest extends PHPUnit_Framework_TestCase
|
|||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->_mockAutoFilterColumnObject = $this->getMockBuilder('PHPExcel_Worksheet_AutoFilter_Column')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->_mockAutoFilterColumnObject->expects($this->any())
|
||||
->method('testColumnInRange')
|
||||
->will($this->returnValue(3));
|
||||
->method('testColumnInRange')
|
||||
->will($this->returnValue(3));
|
||||
|
||||
$this->_testAutoFilterRuleObject = new PHPExcel_Worksheet_AutoFilter_Column_Rule(
|
||||
$this->_mockAutoFilterColumnObject
|
||||
);
|
||||
$this->_testAutoFilterRuleObject = new PHPExcel_Worksheet_AutoFilter_Column_Rule(
|
||||
$this->_mockAutoFilterColumnObject
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetRuleType()
|
||||
{
|
||||
$result = $this->_testAutoFilterRuleObject->getRuleType();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER, $result);
|
||||
}
|
||||
public function testGetRuleType()
|
||||
{
|
||||
$result = $this->_testAutoFilterRuleObject->getRuleType();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER, $result);
|
||||
}
|
||||
|
||||
public function testSetRuleType()
|
||||
{
|
||||
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP;
|
||||
public function testSetRuleType()
|
||||
{
|
||||
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP;
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setRuleType($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setRuleType($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
|
||||
$result = $this->_testAutoFilterRuleObject->getRuleType();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
$result = $this->_testAutoFilterRuleObject->getRuleType();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testSetValue()
|
||||
{
|
||||
$expectedResult = 100;
|
||||
public function testSetValue()
|
||||
{
|
||||
$expectedResult = 100;
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setValue($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setValue($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
|
||||
$result = $this->_testAutoFilterRuleObject->getValue();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
$result = $this->_testAutoFilterRuleObject->getValue();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testGetOperator()
|
||||
{
|
||||
$result = $this->_testAutoFilterRuleObject->getOperator();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result);
|
||||
}
|
||||
public function testGetOperator()
|
||||
{
|
||||
$result = $this->_testAutoFilterRuleObject->getOperator();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result);
|
||||
}
|
||||
|
||||
public function testSetOperator()
|
||||
{
|
||||
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
|
||||
public function testSetOperator()
|
||||
{
|
||||
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setOperator($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setOperator($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
|
||||
$result = $this->_testAutoFilterRuleObject->getOperator();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
$result = $this->_testAutoFilterRuleObject->getOperator();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testSetGrouping()
|
||||
{
|
||||
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH;
|
||||
public function testSetGrouping()
|
||||
{
|
||||
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH;
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setGrouping($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setGrouping($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
|
||||
$result = $this->_testAutoFilterRuleObject->getGrouping();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
$result = $this->_testAutoFilterRuleObject->getGrouping();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testGetParent()
|
||||
{
|
||||
$result = $this->_testAutoFilterRuleObject->getParent();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
public function testGetParent()
|
||||
{
|
||||
$result = $this->_testAutoFilterRuleObject->getParent();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
|
||||
public function testSetParent()
|
||||
{
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setParent($this->_mockAutoFilterColumnObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
}
|
||||
public function testSetParent()
|
||||
{
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setParent($this->_mockAutoFilterColumnObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
}
|
||||
|
||||
public function testClone()
|
||||
{
|
||||
$result = clone $this->_testAutoFilterRuleObject;
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
}
|
||||
public function testClone()
|
||||
{
|
||||
$result = clone $this->_testAutoFilterRuleObject;
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
class AutofilterColumnTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $_testInitialColumn = 'H';
|
||||
private $_testInitialColumn = 'H';
|
||||
|
||||
private $_testAutoFilterColumnObject;
|
||||
private $_testAutoFilterColumnObject;
|
||||
|
||||
private $_mockAutoFilterObject;
|
||||
private $_mockAutoFilterObject;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
|
@ -17,157 +17,157 @@ class AutofilterColumnTest extends PHPUnit_Framework_TestCase
|
|||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->_mockAutoFilterObject = $this->getMockBuilder('PHPExcel_Worksheet_AutoFilter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->_mockAutoFilterObject->expects($this->any())
|
||||
->method('testColumnInRange')
|
||||
->will($this->returnValue(3));
|
||||
->method('testColumnInRange')
|
||||
->will($this->returnValue(3));
|
||||
|
||||
$this->_testAutoFilterColumnObject = new PHPExcel_Worksheet_AutoFilter_Column(
|
||||
$this->_testInitialColumn,
|
||||
$this->_mockAutoFilterObject
|
||||
);
|
||||
$this->_testAutoFilterColumnObject = new PHPExcel_Worksheet_AutoFilter_Column(
|
||||
$this->_testInitialColumn,
|
||||
$this->_mockAutoFilterObject
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetColumnIndex()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getColumnIndex();
|
||||
$this->assertEquals($this->_testInitialColumn, $result);
|
||||
}
|
||||
public function testGetColumnIndex()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getColumnIndex();
|
||||
$this->assertEquals($this->_testInitialColumn, $result);
|
||||
}
|
||||
|
||||
public function testSetColumnIndex()
|
||||
{
|
||||
$expectedResult = 'L';
|
||||
public function testSetColumnIndex()
|
||||
{
|
||||
$expectedResult = 'L';
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setColumnIndex($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setColumnIndex($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->getColumnIndex();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
$result = $this->_testAutoFilterColumnObject->getColumnIndex();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testGetParent()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getParent();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
}
|
||||
public function testGetParent()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getParent();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
}
|
||||
|
||||
public function testSetParent()
|
||||
{
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setParent($this->_mockAutoFilterObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
public function testSetParent()
|
||||
{
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setParent($this->_mockAutoFilterObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
|
||||
public function testGetFilterType()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getFilterType();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER, $result);
|
||||
}
|
||||
public function testGetFilterType()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getFilterType();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER, $result);
|
||||
}
|
||||
|
||||
public function testSetFilterType()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
public function testSetFilterType()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->getFilterType();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result);
|
||||
}
|
||||
$result = $this->_testAutoFilterColumnObject->getFilterType();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetInvalidFilterTypeThrowsException()
|
||||
{
|
||||
$expectedResult = 'Unfiltered';
|
||||
public function testSetInvalidFilterTypeThrowsException()
|
||||
{
|
||||
$expectedResult = 'Unfiltered';
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->setFilterType($expectedResult);
|
||||
}
|
||||
$result = $this->_testAutoFilterColumnObject->setFilterType($expectedResult);
|
||||
}
|
||||
|
||||
public function testGetJoin()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getJoin();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR, $result);
|
||||
}
|
||||
public function testGetJoin()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getJoin();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR, $result);
|
||||
}
|
||||
|
||||
public function testSetJoin()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
public function testSetJoin()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->getJoin();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND, $result);
|
||||
}
|
||||
$result = $this->_testAutoFilterColumnObject->getJoin();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetInvalidJoinThrowsException()
|
||||
{
|
||||
$expectedResult = 'Neither';
|
||||
public function testSetInvalidJoinThrowsException()
|
||||
{
|
||||
$expectedResult = 'Neither';
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->setJoin($expectedResult);
|
||||
}
|
||||
$result = $this->_testAutoFilterColumnObject->setJoin($expectedResult);
|
||||
}
|
||||
|
||||
public function testSetAttributes()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
public function testSetAttributes()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
|
||||
public function testGetAttributes()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
public function testGetAttributes()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
|
||||
$this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||
$this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->getAttributes();
|
||||
$this->assertTrue(is_array($result));
|
||||
$this->assertEquals(count($attributeSet), count($result));
|
||||
}
|
||||
$result = $this->_testAutoFilterColumnObject->getAttributes();
|
||||
$this->assertTrue(is_array($result));
|
||||
$this->assertEquals(count($attributeSet), count($result));
|
||||
}
|
||||
|
||||
public function testSetAttribute()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
public function testSetAttribute()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
|
||||
foreach($attributeSet as $attributeName => $attributeValue) {
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setAttribute($attributeName,$attributeValue);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
}
|
||||
foreach ($attributeSet as $attributeName => $attributeValue) {
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setAttribute($attributeName,$attributeValue);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetAttribute()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
public function testGetAttribute()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
|
||||
$this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||
$this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||
|
||||
foreach($attributeSet as $attributeName => $attributeValue) {
|
||||
$result = $this->_testAutoFilterColumnObject->getAttribute($attributeName);
|
||||
$this->assertEquals($attributeValue, $result);
|
||||
}
|
||||
$result = $this->_testAutoFilterColumnObject->getAttribute('nonExistentAttribute');
|
||||
$this->assertNull($result);
|
||||
}
|
||||
foreach ($attributeSet as $attributeName => $attributeValue) {
|
||||
$result = $this->_testAutoFilterColumnObject->getAttribute($attributeName);
|
||||
$this->assertEquals($attributeValue, $result);
|
||||
}
|
||||
$result = $this->_testAutoFilterColumnObject->getAttribute('nonExistentAttribute');
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
public function testClone()
|
||||
{
|
||||
$result = clone $this->_testAutoFilterColumnObject;
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
public function testClone()
|
||||
{
|
||||
$result = clone $this->_testAutoFilterColumnObject;
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
class AutoFilterTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $_testInitialRange = 'H2:O256';
|
||||
private $_testInitialRange = 'H2:O256';
|
||||
|
||||
private $_testAutoFilterObject;
|
||||
private $_testAutoFilterObject;
|
||||
|
||||
|
||||
public function setUp()
|
||||
|
@ -16,325 +16,325 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
|
|||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->_mockWorksheetObject = $this->getMockBuilder('PHPExcel_Worksheet')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->_mockCacheController = $this->getMockBuilder('PHPExcel_CachedObjectStorage_Memory')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->_mockWorksheetObject->expects($this->any())
|
||||
->method('getCellCacheController')
|
||||
->will($this->returnValue($this->_mockCacheController));
|
||||
|
||||
$this->_testAutoFilterObject = new PHPExcel_Worksheet_AutoFilter(
|
||||
$this->_testInitialRange,
|
||||
$this->_mockWorksheetObject
|
||||
);
|
||||
$this->_testAutoFilterObject = new PHPExcel_Worksheet_AutoFilter(
|
||||
$this->_testInitialRange,
|
||||
$this->_mockWorksheetObject
|
||||
);
|
||||
}
|
||||
|
||||
public function testToString()
|
||||
{
|
||||
$expectedResult = $this->_testInitialRange;
|
||||
public function testToString()
|
||||
{
|
||||
$expectedResult = $this->_testInitialRange;
|
||||
|
||||
// magic __toString should return the active autofilter range
|
||||
$result = $this->_testAutoFilterObject;
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
// magic __toString should return the active autofilter range
|
||||
$result = $this->_testAutoFilterObject;
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testGetParent()
|
||||
{
|
||||
$result = $this->_testAutoFilterObject->getParent();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet', $result);
|
||||
}
|
||||
public function testGetParent()
|
||||
{
|
||||
$result = $this->_testAutoFilterObject->getParent();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet', $result);
|
||||
}
|
||||
|
||||
public function testSetParent()
|
||||
{
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setParent($this->_mockWorksheetObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
}
|
||||
public function testSetParent()
|
||||
{
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setParent($this->_mockWorksheetObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
}
|
||||
|
||||
public function testGetRange()
|
||||
{
|
||||
$expectedResult = $this->_testInitialRange;
|
||||
public function testGetRange()
|
||||
{
|
||||
$expectedResult = $this->_testInitialRange;
|
||||
|
||||
// Result should be the active autofilter range
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
// Result should be the active autofilter range
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testSetRange()
|
||||
{
|
||||
$ranges = array('G1:J512' => 'Worksheet1!G1:J512',
|
||||
'K1:N20' => 'K1:N20'
|
||||
);
|
||||
public function testSetRange()
|
||||
{
|
||||
$ranges = array('G1:J512' => 'Worksheet1!G1:J512',
|
||||
'K1:N20' => 'K1:N20'
|
||||
);
|
||||
|
||||
foreach($ranges as $actualRange => $fullRange) {
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange($fullRange);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
foreach ($ranges as $actualRange => $fullRange) {
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange($fullRange);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
// Result should be the new autofilter range
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($actualRange, $result);
|
||||
}
|
||||
}
|
||||
// Result should be the new autofilter range
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($actualRange, $result);
|
||||
}
|
||||
}
|
||||
|
||||
public function testClearRange()
|
||||
{
|
||||
$expectedResult = '';
|
||||
public function testClearRange()
|
||||
{
|
||||
$expectedResult = '';
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
// Result should be a clear range
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
// Result should be a clear range
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetRangeInvalidRange()
|
||||
{
|
||||
$expectedResult = 'A1';
|
||||
public function testSetRangeInvalidRange()
|
||||
{
|
||||
$expectedResult = 'A1';
|
||||
|
||||
$result = $this->_testAutoFilterObject->setRange($expectedResult);
|
||||
}
|
||||
$result = $this->_testAutoFilterObject->setRange($expectedResult);
|
||||
}
|
||||
|
||||
public function testGetColumnsEmpty()
|
||||
{
|
||||
// There should be no columns yet defined
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(0, count($result));
|
||||
}
|
||||
public function testGetColumnsEmpty()
|
||||
{
|
||||
// There should be no columns yet defined
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(0, count($result));
|
||||
}
|
||||
|
||||
public function testGetColumnOffset()
|
||||
{
|
||||
$columnIndexes = array( 'H' => 0,
|
||||
'K' => 3,
|
||||
'M' => 5
|
||||
);
|
||||
public function testGetColumnOffset()
|
||||
{
|
||||
$columnIndexes = array( 'H' => 0,
|
||||
'K' => 3,
|
||||
'M' => 5
|
||||
);
|
||||
|
||||
// If we request a specific column by its column ID, we should get an
|
||||
// integer returned representing the column offset within the range
|
||||
foreach($columnIndexes as $columnIndex => $columnOffset) {
|
||||
$result = $this->_testAutoFilterObject->getColumnOffset($columnIndex);
|
||||
$this->assertEquals($columnOffset, $result);
|
||||
}
|
||||
}
|
||||
// If we request a specific column by its column ID, we should get an
|
||||
// integer returned representing the column offset within the range
|
||||
foreach ($columnIndexes as $columnIndex => $columnOffset) {
|
||||
$result = $this->_testAutoFilterObject->getColumnOffset($columnIndex);
|
||||
$this->assertEquals($columnOffset, $result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testGetInvalidColumnOffset()
|
||||
{
|
||||
$invalidColumn = 'G';
|
||||
{
|
||||
$invalidColumn = 'G';
|
||||
|
||||
$result = $this->_testAutoFilterObject->getColumnOffset($invalidColumn);
|
||||
}
|
||||
$result = $this->_testAutoFilterObject->getColumnOffset($invalidColumn);
|
||||
}
|
||||
|
||||
public function testSetColumnWithString()
|
||||
{
|
||||
$expectedResult = 'L';
|
||||
public function testSetColumnWithString()
|
||||
{
|
||||
$expectedResult = 'L';
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setColumn($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setColumn($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
|
||||
// objects for each column we set indexed by the column ID
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertArrayHasKey($expectedResult,$result);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]);
|
||||
}
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
|
||||
// objects for each column we set indexed by the column ID
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertArrayHasKey($expectedResult,$result);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetInvalidColumnWithString()
|
||||
{
|
||||
$invalidColumn = 'A';
|
||||
{
|
||||
$invalidColumn = 'A';
|
||||
|
||||
$result = $this->_testAutoFilterObject->setColumn($invalidColumn);
|
||||
}
|
||||
$result = $this->_testAutoFilterObject->setColumn($invalidColumn);
|
||||
}
|
||||
|
||||
public function testSetColumnWithColumnObject()
|
||||
{
|
||||
$expectedResult = 'M';
|
||||
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($expectedResult);
|
||||
public function testSetColumnWithColumnObject()
|
||||
{
|
||||
$expectedResult = 'M';
|
||||
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($expectedResult);
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setColumn($columnObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setColumn($columnObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
|
||||
// objects for each column we set indexed by the column ID
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertArrayHasKey($expectedResult,$result);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]);
|
||||
}
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
|
||||
// objects for each column we set indexed by the column ID
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertArrayHasKey($expectedResult,$result);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetInvalidColumnWithObject()
|
||||
{
|
||||
$invalidColumn = 'E';
|
||||
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn);
|
||||
{
|
||||
$invalidColumn = 'E';
|
||||
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn);
|
||||
|
||||
$result = $this->_testAutoFilterObject->setColumn($invalidColumn);
|
||||
}
|
||||
$result = $this->_testAutoFilterObject->setColumn($invalidColumn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetColumnWithInvalidDataType()
|
||||
{
|
||||
$invalidColumn = 123.456;
|
||||
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn);
|
||||
{
|
||||
$invalidColumn = 123.456;
|
||||
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn);
|
||||
|
||||
$result = $this->_testAutoFilterObject->setColumn($invalidColumn);
|
||||
}
|
||||
$result = $this->_testAutoFilterObject->setColumn($invalidColumn);
|
||||
}
|
||||
|
||||
public function testGetColumns()
|
||||
{
|
||||
$columnIndexes = array('L','M');
|
||||
public function testGetColumns()
|
||||
{
|
||||
$columnIndexes = array('L','M');
|
||||
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
foreach ($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
|
||||
// objects for each column we set indexed by the column ID
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(count($columnIndexes), count($result));
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$this->assertArrayHasKey($columnIndex,$result);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$columnIndex]);
|
||||
}
|
||||
}
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
|
||||
// objects for each column we set indexed by the column ID
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(count($columnIndexes), count($result));
|
||||
foreach ($columnIndexes as $columnIndex) {
|
||||
$this->assertArrayHasKey($columnIndex,$result);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$columnIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetColumn()
|
||||
{
|
||||
$columnIndexes = array('L','M');
|
||||
public function testGetColumn()
|
||||
{
|
||||
$columnIndexes = array('L','M');
|
||||
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
foreach ($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
|
||||
// If we request a specific column by its column ID, we should
|
||||
// get a PHPExcel_Worksheet_AutoFilter_Column object returned
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$result = $this->_testAutoFilterObject->getColumn($columnIndex);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
}
|
||||
// If we request a specific column by its column ID, we should
|
||||
// get a PHPExcel_Worksheet_AutoFilter_Column object returned
|
||||
foreach ($columnIndexes as $columnIndex) {
|
||||
$result = $this->_testAutoFilterObject->getColumn($columnIndex);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetColumnByOffset()
|
||||
{
|
||||
$columnIndexes = array( 0 => 'H',
|
||||
3 => 'K',
|
||||
5 => 'M'
|
||||
);
|
||||
public function testGetColumnByOffset()
|
||||
{
|
||||
$columnIndexes = array( 0 => 'H',
|
||||
3 => 'K',
|
||||
5 => 'M'
|
||||
);
|
||||
|
||||
// If we request a specific column by its offset, we should
|
||||
// get a PHPExcel_Worksheet_AutoFilter_Column object returned
|
||||
foreach($columnIndexes as $columnIndex => $columnID) {
|
||||
$result = $this->_testAutoFilterObject->getColumnByOffset($columnIndex);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
$this->assertEquals($result->getColumnIndex(),$columnID);
|
||||
}
|
||||
}
|
||||
// If we request a specific column by its offset, we should
|
||||
// get a PHPExcel_Worksheet_AutoFilter_Column object returned
|
||||
foreach ($columnIndexes as $columnIndex => $columnID) {
|
||||
$result = $this->_testAutoFilterObject->getColumnByOffset($columnIndex);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
$this->assertEquals($result->getColumnIndex(),$columnID);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetColumnIfNotSet()
|
||||
{
|
||||
// If we request a specific column by its column ID, we should
|
||||
// get a PHPExcel_Worksheet_AutoFilter_Column object returned
|
||||
$result = $this->_testAutoFilterObject->getColumn('K');
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
public function testGetColumnIfNotSet()
|
||||
{
|
||||
// If we request a specific column by its column ID, we should
|
||||
// get a PHPExcel_Worksheet_AutoFilter_Column object returned
|
||||
$result = $this->_testAutoFilterObject->getColumn('K');
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testGetColumnWithoutRangeSet()
|
||||
{
|
||||
// Clear the range
|
||||
$result = $this->_testAutoFilterObject->setRange();
|
||||
public function testGetColumnWithoutRangeSet()
|
||||
{
|
||||
// Clear the range
|
||||
$result = $this->_testAutoFilterObject->setRange();
|
||||
|
||||
$result = $this->_testAutoFilterObject->getColumn('A');
|
||||
}
|
||||
$result = $this->_testAutoFilterObject->getColumn('A');
|
||||
}
|
||||
|
||||
public function testClearRangeWithExistingColumns()
|
||||
{
|
||||
$expectedResult = '';
|
||||
public function testClearRangeWithExistingColumns()
|
||||
{
|
||||
$expectedResult = '';
|
||||
|
||||
$columnIndexes = array('L','M','N');
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
$columnIndexes = array('L','M','N');
|
||||
foreach ($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
// Range should be cleared
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
// Range should be cleared
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
|
||||
// Column array should be cleared
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(0, count($result));
|
||||
}
|
||||
// Column array should be cleared
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(0, count($result));
|
||||
}
|
||||
|
||||
public function testSetRangeWithExistingColumns()
|
||||
{
|
||||
$expectedResult = 'G1:J512';
|
||||
public function testSetRangeWithExistingColumns()
|
||||
{
|
||||
$expectedResult = 'G1:J512';
|
||||
|
||||
// These columns should be retained
|
||||
$columnIndexes1 = array('I','J');
|
||||
foreach($columnIndexes1 as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
// These columns should be discarded
|
||||
$columnIndexes2 = array('K','L','M');
|
||||
foreach($columnIndexes2 as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
// These columns should be retained
|
||||
$columnIndexes1 = array('I','J');
|
||||
foreach ($columnIndexes1 as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
// These columns should be discarded
|
||||
$columnIndexes2 = array('K','L','M');
|
||||
foreach ($columnIndexes2 as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
// Range should be correctly set
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
// Range should be correctly set
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
|
||||
// Only columns that existed in the original range and that
|
||||
// still fall within the new range should be retained
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(count($columnIndexes1), count($result));
|
||||
}
|
||||
// Only columns that existed in the original range and that
|
||||
// still fall within the new range should be retained
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(count($columnIndexes1), count($result));
|
||||
}
|
||||
|
||||
public function testClone()
|
||||
{
|
||||
$columnIndexes = array('L','M');
|
||||
public function testClone()
|
||||
{
|
||||
$columnIndexes = array('L','M');
|
||||
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
foreach ($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
|
||||
$result = clone $this->_testAutoFilterObject;
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
}
|
||||
$result = clone $this->_testAutoFilterObject;
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,29 +3,29 @@
|
|||
class CellCollectionTest 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 setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT'))
|
||||
{
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
public function testCacheLastCell()
|
||||
{
|
||||
$methods = PHPExcel_CachedObjectStorageFactory::getCacheStorageMethods();
|
||||
foreach ($methods as $method) {
|
||||
PHPExcel_CachedObjectStorageFactory::initialize($method);
|
||||
$workbook = new PHPExcel();
|
||||
$cells = array('A1', 'A2');
|
||||
$worksheet = $workbook->getActiveSheet();
|
||||
$worksheet->setCellValue('A1', 1);
|
||||
$worksheet->setCellValue('A2', 2);
|
||||
$this->assertEquals($cells, $worksheet->getCellCollection(), "Cache method \"$method\".");
|
||||
PHPExcel_CachedObjectStorageFactory::finalize();
|
||||
}
|
||||
}
|
||||
public function testCacheLastCell()
|
||||
{
|
||||
$methods = PHPExcel_CachedObjectStorageFactory::getCacheStorageMethods();
|
||||
foreach ($methods as $method) {
|
||||
PHPExcel_CachedObjectStorageFactory::initialize($method);
|
||||
$workbook = new PHPExcel();
|
||||
$cells = array('A1', 'A2');
|
||||
$worksheet = $workbook->getActiveSheet();
|
||||
$worksheet->setCellValue('A1', 1);
|
||||
$worksheet->setCellValue('A2', 2);
|
||||
$this->assertEquals($cells, $worksheet->getCellCollection(), "Cache method \"$method\".");
|
||||
PHPExcel_CachedObjectStorageFactory::finalize();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
|
|||
public $mockWorksheet;
|
||||
public $mockColumnCell;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockCell = $this->getMockBuilder('PHPExcel_Cell')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -29,32 +29,32 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A');
|
||||
$ColumnCellIndexResult = 1;
|
||||
$this->assertEquals($ColumnCellIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $ColumnCell) {
|
||||
foreach ($iterator as $key => $ColumnCell) {
|
||||
$this->assertEquals($ColumnCellIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Cell', $ColumnCell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
|
||||
$ColumnCellIndexResult = 2;
|
||||
$this->assertEquals($ColumnCellIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $ColumnCell) {
|
||||
foreach ($iterator as $key => $ColumnCell) {
|
||||
$this->assertEquals($ColumnCellIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Cell', $ColumnCell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
|
||||
$columnIndexResult = 4;
|
||||
$iterator->seek(4);
|
||||
|
@ -64,7 +64,7 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
|
|||
$iterator->prev();
|
||||
$this->assertEquals($columnIndexResult - $i, $iterator->key());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
|
|
|
@ -5,12 +5,12 @@ class ColumnIteratorTest extends PHPUnit_Framework_TestCase
|
|||
public $mockWorksheet;
|
||||
public $mockColumn;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockColumn = $this->getMockBuilder('PHPExcel_Worksheet_Column')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -29,32 +29,32 @@ class ColumnIteratorTest extends PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet);
|
||||
$columnIndexResult = 'A';
|
||||
$this->assertEquals($columnIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $column) {
|
||||
foreach ($iterator as $key => $column) {
|
||||
$this->assertEquals($columnIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
|
||||
$columnIndexResult = 'B';
|
||||
$this->assertEquals($columnIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $column) {
|
||||
foreach ($iterator as $key => $column) {
|
||||
$this->assertEquals($columnIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
$ranges = range('A','E');
|
||||
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
|
||||
$columnIndexResult = 'D';
|
||||
|
@ -66,7 +66,7 @@ class ColumnIteratorTest extends PHPUnit_Framework_TestCase
|
|||
$expectedResult = $ranges[array_search($columnIndexResult, $ranges) - $i];
|
||||
$this->assertEquals($expectedResult, $iterator->key());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
|
|
|
@ -5,12 +5,12 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase
|
|||
public $mockWorksheet;
|
||||
public $mockRowCell;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockCell = $this->getMockBuilder('PHPExcel_Cell')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -29,32 +29,32 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet);
|
||||
$RowCellIndexResult = 'A';
|
||||
$this->assertEquals($RowCellIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $RowCell) {
|
||||
foreach ($iterator as $key => $RowCell) {
|
||||
$this->assertEquals($RowCellIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Cell', $RowCell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
||||
$RowCellIndexResult = 'B';
|
||||
$this->assertEquals($RowCellIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $RowCell) {
|
||||
foreach ($iterator as $key => $RowCell) {
|
||||
$this->assertEquals($RowCellIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Cell', $RowCell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
$ranges = range('A','E');
|
||||
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
||||
$RowCellIndexResult = 'D';
|
||||
|
@ -66,7 +66,7 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase
|
|||
$expectedResult = $ranges[array_search($RowCellIndexResult, $ranges) - $i];
|
||||
$this->assertEquals($expectedResult, $iterator->key());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
|
|
|
@ -5,12 +5,12 @@ class RowIteratorTest extends PHPUnit_Framework_TestCase
|
|||
public $mockWorksheet;
|
||||
public $mockRow;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockRow = $this->getMockBuilder('PHPExcel_Worksheet_Row')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -29,32 +29,32 @@ class RowIteratorTest extends PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet);
|
||||
$rowIndexResult = 1;
|
||||
$this->assertEquals($rowIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $row) {
|
||||
foreach ($iterator as $key => $row) {
|
||||
$this->assertEquals($rowIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4);
|
||||
$rowIndexResult = 2;
|
||||
$this->assertEquals($rowIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $row) {
|
||||
foreach ($iterator as $key => $row) {
|
||||
$this->assertEquals($rowIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4);
|
||||
$columnIndexResult = 4;
|
||||
$iterator->seek(4);
|
||||
|
@ -64,7 +64,7 @@ class RowIteratorTest extends PHPUnit_Framework_TestCase
|
|||
$iterator->prev();
|
||||
$this->assertEquals($columnIndexResult - $i, $iterator->key());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
|
|
|
@ -5,12 +5,12 @@ class WorksheetColumnTest extends PHPUnit_Framework_TestCase
|
|||
public $mockWorksheet;
|
||||
public $mockColumn;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -21,26 +21,26 @@ class WorksheetColumnTest extends PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
|
||||
public function testInstantiateColumnDefault()
|
||||
{
|
||||
public function testInstantiateColumnDefault()
|
||||
{
|
||||
$column = new PHPExcel_Worksheet_Column($this->mockWorksheet);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
|
||||
$columnIndex = $column->getColumnIndex();
|
||||
$this->assertEquals('A', $columnIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public function testInstantiateColumnSpecified()
|
||||
{
|
||||
public function testInstantiateColumnSpecified()
|
||||
{
|
||||
$column = new PHPExcel_Worksheet_Column($this->mockWorksheet, 'E');
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
|
||||
$columnIndex = $column->getColumnIndex();
|
||||
$this->assertEquals('E', $columnIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetCellIterator()
|
||||
{
|
||||
public function testGetCellIterator()
|
||||
{
|
||||
$column = new PHPExcel_Worksheet_Column($this->mockWorksheet);
|
||||
$cellIterator = $column->getCellIterator();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_ColumnCellIterator', $cellIterator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@ class WorksheetRowTest extends PHPUnit_Framework_TestCase
|
|||
public $mockWorksheet;
|
||||
public $mockRow;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -21,26 +21,26 @@ class WorksheetRowTest extends PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
|
||||
public function testInstantiateRowDefault()
|
||||
{
|
||||
public function testInstantiateRowDefault()
|
||||
{
|
||||
$row = new PHPExcel_Worksheet_Row($this->mockWorksheet);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
|
||||
$rowIndex = $row->getRowIndex();
|
||||
$this->assertEquals(1, $rowIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public function testInstantiateRowSpecified()
|
||||
{
|
||||
public function testInstantiateRowSpecified()
|
||||
{
|
||||
$row = new PHPExcel_Worksheet_Row($this->mockWorksheet, 5);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
|
||||
$rowIndex = $row->getRowIndex();
|
||||
$this->assertEquals(5, $rowIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetCellIterator()
|
||||
{
|
||||
public function testGetCellIterator()
|
||||
{
|
||||
$row = new PHPExcel_Worksheet_Row($this->mockWorksheet);
|
||||
$cellIterator = $row->getCellIterator();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_RowCellIterator', $cellIterator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,11 +54,11 @@ class testDataFileIterator implements Iterator
|
|||
} while (($testDataRow > '') && ($testDataRow{0} === '#'));
|
||||
|
||||
// Discard any comments at the end of the line
|
||||
list($testData) = explode('//',$testDataRow);
|
||||
list($testData) = explode('//', $testDataRow);
|
||||
|
||||
// Split data into an array of individual values and a result
|
||||
$dataSet = $this->_getcsv($testData, ',', "'");
|
||||
foreach($dataSet as &$dataValue) {
|
||||
foreach ($dataSet as &$dataValue) {
|
||||
$dataValue = $this->_parseDataValue($dataValue);
|
||||
}
|
||||
unset($dataValue);
|
||||
|
@ -85,23 +85,24 @@ class testDataFileIterator implements Iterator
|
|||
return $data;
|
||||
}
|
||||
|
||||
private function _parseDataValue($dataValue) {
|
||||
private function _parseDataValue($dataValue)
|
||||
{
|
||||
// discard any white space
|
||||
$dataValue = trim($dataValue);
|
||||
// test for the required datatype and convert accordingly
|
||||
if (!is_numeric($dataValue)) {
|
||||
if($dataValue == '') {
|
||||
$dataValue = NULL;
|
||||
$dataValue = null;
|
||||
} elseif($dataValue == '""') {
|
||||
$dataValue = '';
|
||||
} elseif(($dataValue[0] == '"') && ($dataValue[strlen($dataValue)-1] == '"')) {
|
||||
$dataValue = substr($dataValue,1,-1);
|
||||
} elseif(($dataValue[0] == '{') && ($dataValue[strlen($dataValue)-1] == '}')) {
|
||||
$dataValue = explode(';',substr($dataValue,1,-1));
|
||||
foreach($dataValue as &$dataRow) {
|
||||
if (strpos($dataRow,'|') !== FALSE) {
|
||||
foreach ($dataValue as &$dataRow) {
|
||||
if (strpos($dataRow,'|') !== false) {
|
||||
$dataRow = explode('|',$dataRow);
|
||||
foreach($dataRow as &$dataCell) {
|
||||
foreach ($dataRow as &$dataCell) {
|
||||
$dataCell = $this->_parseDataValue($dataCell);
|
||||
}
|
||||
unset($dataCell);
|
||||
|
@ -112,20 +113,25 @@ class testDataFileIterator implements Iterator
|
|||
unset($dataRow);
|
||||
} else {
|
||||
switch (strtoupper($dataValue)) {
|
||||
case 'NULL' : $dataValue = NULL; break;
|
||||
case 'TRUE' : $dataValue = TRUE; break;
|
||||
case 'FALSE' : $dataValue = FALSE; break;
|
||||
case 'NULL':
|
||||
$dataValue = null;
|
||||
break;
|
||||
case 'TRUE':
|
||||
$dataValue = true;
|
||||
break;
|
||||
case 'FALSE':
|
||||
$dataValue = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (strpos($dataValue,'.') !== FALSE) {
|
||||
if (strpos($dataValue,'.') !== false) {
|
||||
$dataValue = (float) $dataValue;
|
||||
} else {
|
||||
$dataValue = (int) $dataValue;
|
||||
}
|
||||
}
|
||||
|
||||
return $dataValue;
|
||||
return $dataValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue