PSR2 Fixes

This commit is contained in:
Progi1984 2015-05-17 15:00:02 +02:00
parent 1d842ed218
commit 09352e3e80
52 changed files with 3250 additions and 3204 deletions

View File

@ -387,7 +387,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return boolean * @return boolean
*/ */
public function getContiguous(){ public function getContiguous()
{
return $this->_contiguous; return $this->_contiguous;
} }
} }

View File

@ -257,11 +257,11 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
*/ */
protected static function _pixel2WidthUnits($pxs) 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 = 256 * ($pxs / 7);
$widthUnits += $UNIT_OFFSET_MAP[($pxs % 7)]; $widthUnits += $UNIT_OFFSET_MAP[($pxs % 7)];
return $widthUnits; return $widthUnits;
} }
/** /**

View File

@ -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 // Standard filters are always an OR join, so no join rule needs to be set
// Entries can be either filter elements // Entries can be either filter elements
foreach ($filters->filter as $filterRule) { foreach ($filters->filter as $filterRule) {
$column->createRule()->setRule( // Operator is undefined, but always treated as EQUAL
null,// Operator is undefined, but always treated as EQUAL $column->createRule()->setRule(null, (string) $filterRule["val"])->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
(string) $filterRule["val"]
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
} }
// Or Date Group elements // Or Date Group elements
foreach ($filters->dateGroupItem as $dateGroupItem) { foreach ($filters->dateGroupItem as $dateGroupItem) {
$column->createRule()->setRule( $column->createRule()->setRule(
null,// Operator is undefined, but always treated as EQUAL // Operator is undefined, but always treated as EQUAL
null,
array( array(
'year' => (string) $dateGroupItem["year"], 'year' => (string) $dateGroupItem["year"],
'month' => (string) $dateGroupItem["month"], '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 // We should only ever have one dynamic filter
foreach ($filterColumn->dynamicFilter as $filterRule) { foreach ($filterColumn->dynamicFilter as $filterRule) {
$column->createRule()->setRule( $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["val"],
(string) $filterRule["type"] (string) $filterRule["type"]
) )

View File

@ -81,21 +81,21 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($chartDetails as $chartDetailKey => $chartDetail) { foreach ($chartDetails as $chartDetailKey => $chartDetail) {
switch ($chartDetailKey) { switch ($chartDetailKey) {
case "layout": case "layout":
$plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'plotArea'); $plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta, 'plotArea');
break; break;
case "catAx": case "catAx":
if (isset($chartDetail->title)) { 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; break;
case "dateAx": case "dateAx":
if (isset($chartDetail->title)) { 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; break;
case "valAx": case "valAx":
if (isset($chartDetail->title)) { 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; break;
case "barChart": case "barChart":
@ -173,7 +173,7 @@ class PHPExcel_Reader_Excel2007_Chart
$dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string'); $dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string');
break; break;
case "title": case "title":
$title = self::_chartTitle($chartDetails, $namespacesChartMeta,'title'); $title = self::_chartTitle($chartDetails, $namespacesChartMeta, 'title');
break; break;
case "legend": case "legend":
$legendPos = 'r'; $legendPos = 'r';
@ -188,7 +188,7 @@ class PHPExcel_Reader_Excel2007_Chart
$legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean'); $legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean');
break; break;
case "layout": case "layout":
$legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'legend'); $legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta, 'legend');
break; break;
} }
} }
@ -239,7 +239,7 @@ class PHPExcel_Reader_Excel2007_Chart
} }
$layout = array(); $layout = array();
foreach ($details as $detailKey => $detail) { 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'); $layout[$detailKey] = self::_getAttribute($detail, 'val', 'string');
} }
return new PHPExcel_Chart_Layout($layout); return new PHPExcel_Chart_Layout($layout);
@ -300,7 +300,7 @@ class PHPExcel_Reader_Excel2007_Chart
{ {
if (isset($seriesDetail->strRef)) { if (isset($seriesDetail->strRef)) {
$seriesSource = (string) $seriesDetail->strRef->f; $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); return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->numRef)) { } 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); return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->multiLvlStrRef)) { } elseif (isset($seriesDetail->multiLvlStrRef)) {
$seriesSource = (string) $seriesDetail->multiLvlStrRef->f; $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']); $seriesData['pointCount'] = count($seriesData['dataValues']);
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->multiLvlNumRef)) { } elseif (isset($seriesDetail->multiLvlNumRef)) {
$seriesSource = (string) $seriesDetail->multiLvlNumRef->f; $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']); $seriesData['pointCount'] = count($seriesData['dataValues']);
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); 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) { foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
if (isset($titleDetailElement->t)) { if (isset($titleDetailElement->t)) {
$objText = $value->createTextRun( (string) $titleDetailElement->t ); $objText = $value->createTextRun((string) $titleDetailElement->t);
} }
if (isset($titleDetailElement->rPr)) { if (isset($titleDetailElement->rPr)) {
if (isset($titleDetailElement->rPr->rFont["val"])) { if (isset($titleDetailElement->rPr->rFont["val"])) {
@ -414,7 +414,7 @@ class PHPExcel_Reader_Excel2007_Chart
$fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string')); $fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string'));
if (!is_null($fontColor)) { 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'); $bold = self::_getAttribute($titleDetailElement->rPr, 'b', 'boolean');
@ -495,25 +495,25 @@ class PHPExcel_Reader_Excel2007_Chart
{ {
foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) { foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
switch ($plotAttributeKey) { switch ($plotAttributeKey) {
case 'showLegendKey' : case 'showLegendKey':
$plotArea->setShowLegendKey($plotAttributeValue); $plotArea->setShowLegendKey($plotAttributeValue);
break; break;
case 'showVal' : case 'showVal':
$plotArea->setShowVal($plotAttributeValue); $plotArea->setShowVal($plotAttributeValue);
break; break;
case 'showCatName' : case 'showCatName':
$plotArea->setShowCatName($plotAttributeValue); $plotArea->setShowCatName($plotAttributeValue);
break; break;
case 'showSerName' : case 'showSerName':
$plotArea->setShowSerName($plotAttributeValue); $plotArea->setShowSerName($plotAttributeValue);
break; break;
case 'showPercent' : case 'showPercent':
$plotArea->setShowPercent($plotAttributeValue); $plotArea->setShowPercent($plotAttributeValue);
break; break;
case 'showBubbleSize' : case 'showBubbleSize':
$plotArea->setShowBubbleSize($plotAttributeValue); $plotArea->setShowBubbleSize($plotAttributeValue);
break; break;
case 'showLeaderLines' : case 'showLeaderLines':
$plotArea->setShowLeaderLines($plotAttributeValue); $plotArea->setShowLeaderLines($plotAttributeValue);
break; break;
} }

View File

@ -559,7 +559,6 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
// Parse the individual sheets // Parse the individual sheets
foreach ($this->_sheets as $sheet) { foreach ($this->_sheets as $sheet) {
if ($sheet['sheetType'] != 0x00) { if ($sheet['sheetType'] != 0x00) {
// 0x00: Worksheet // 0x00: Worksheet
// 0x02: Chart // 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 // 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 // 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 // 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->_phpSheet->setSheetState($sheet['sheetState']);
$this->_pos = $sheet['offset']; $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 />'; // echo '<b>Cell annotation ', $note,'</b><br />';
// var_dump($noteDetails); // var_dump($noteDetails);
// echo '<br />'; // 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'])); $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); $explodes = explode('!', $range);
if (count($explodes) == 2) { if (count($explodes) == 2) {
if ($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) { if ($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) {
$extractedRange = $explodes[1]; $extractedRange = $explodes[1];
$extractedRange = str_replace('$', '', $extractedRange); $extractedRange = str_replace('$', '', $extractedRange);
@ -1213,7 +1211,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
if (count($explodes) == 2) { if (count($explodes) == 2) {
if (($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) || 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 = $explodes[1];
$extractedRange = str_replace('$', '', $extractedRange); $extractedRange = str_replace('$', '', $extractedRange);
@ -1639,7 +1637,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
} }
// echo 'Note Address=', $cellAddress,'<br />'; // echo 'Note Address=', $cellAddress,'<br />';
$cellAddress = str_replace('$','', $cellAddress); $cellAddress = str_replace('$', '', $cellAddress);
$noteLength = self::_GetInt2d($recordData, 4); $noteLength = self::_GetInt2d($recordData, 4);
$noteText = trim(substr($recordData, 6)); $noteText = trim(substr($recordData, 6));
// echo 'Note Length=', $noteLength,'<br />'; // 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: 0; mask 0x0001; bold (redundant in BIFF5-BIFF8)
// bit: 1; mask 0x0002; italic // bit: 1; mask 0x0002; italic
$isItalic = (0x0002 & self::_GetInt2d($recordData, 2)) >> 1; $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: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8)
// bit: 3; mask 0x0008; strike // bit: 3; mask 0x0008; strike
$isStrike = (0x0008 & self::_GetInt2d($recordData, 2)) >> 3; $isStrike = (0x0008 & self::_GetInt2d($recordData, 2)) >> 3;
if ($isStrike) $objFont->setStrikethrough(true); if ($isStrike) {
$objFont->setStrikethrough(true);
}
// offset: 4; size: 2; colour index // offset: 4; size: 2; colour index
$colorIndex = self::_GetInt2d($recordData, 4); $colorIndex = self::_GetInt2d($recordData, 4);
@ -2557,11 +2559,11 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$builtInId = ord($recordData{2}); $builtInId = ord($recordData{2});
switch ($builtInId) { switch ($builtInId) {
case 0x00: case 0x00:
// currently, we are not using this for anything // currently, we are not using this for anything
break; break;
default: default:
break; break;
} }
} else { } else {
// user-defined; not supported by PHPExcel // 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) // loop through the Unicode strings (16-bit length)
for ($i = 0; $i < $nm; ++$i) { for ($i = 0; $i < $nm; ++$i) {
// number of characters in the Unicode string // number of characters in the Unicode string
$numChars = self::_GetInt2d($recordData, $pos); $numChars = self::_GetInt2d($recordData, $pos);
$pos += 2; $pos += 2;
@ -3923,21 +3924,18 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
} elseif ((ord($recordData{6}) == 1) } elseif ((ord($recordData{6}) == 1)
&& (ord($recordData{12}) == 255) && (ord($recordData{12}) == 255)
&& (ord($recordData{13}) == 255)) { && (ord($recordData{13}) == 255)) {
// Boolean formula. Result is in +2; 0=false, 1=true // Boolean formula. Result is in +2; 0=false, 1=true
$dataType = PHPExcel_Cell_DataType::TYPE_BOOL; $dataType = PHPExcel_Cell_DataType::TYPE_BOOL;
$value = (bool) ord($recordData{8}); $value = (bool) ord($recordData{8});
} elseif ((ord($recordData{6}) == 2) } elseif ((ord($recordData{6}) == 2)
&& (ord($recordData{12}) == 255) && (ord($recordData{12}) == 255)
&& (ord($recordData{13}) == 255)) { && (ord($recordData{13}) == 255)) {
// Error formula. Error code is in +2 // Error formula. Error code is in +2
$dataType = PHPExcel_Cell_DataType::TYPE_ERROR; $dataType = PHPExcel_Cell_DataType::TYPE_ERROR;
$value = self::_mapErrorCode(ord($recordData{8})); $value = self::_mapErrorCode(ord($recordData{8}));
} elseif ((ord($recordData{6}) == 3) } elseif ((ord($recordData{6}) == 3)
&& (ord($recordData{12}) == 255) && (ord($recordData{12}) == 255)
&& (ord($recordData{13}) == 255)) { && (ord($recordData{13}) == 255)) {
// Formula result is a null string // Formula result is a null string
$dataType = PHPExcel_Cell_DataType::TYPE_NULL; $dataType = PHPExcel_Cell_DataType::TYPE_NULL;
$value = ''; $value = '';
@ -4352,7 +4350,8 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
/** /**
* Read PLV Record(Created by Excel2007 or upper) * Read PLV Record(Created by Excel2007 or upper)
*/ */
private function _readPageLayoutView() { private function _readPageLayoutView()
{
$length = self::_GetInt2d($this->_data, $this->_pos + 2); $length = self::_GetInt2d($this->_data, $this->_pos + 2);
$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); $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) { if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) {
$cellRangeAddressList = $this->_readBIFF8CellRangeAddressList($recordData); $cellRangeAddressList = $this->_readBIFF8CellRangeAddressList($recordData);
foreach ($cellRangeAddressList['cellRangeAddresses'] as $cellRangeAddress) { foreach ($cellRangeAddressList['cellRangeAddresses'] as $cellRangeAddress) {
if ((strpos($cellRangeAddress,':') !== false) && if ((strpos($cellRangeAddress, ':') !== false) &&
($this->_includeCellRangeFiltered($cellRangeAddress))) { ($this->_includeCellRangeFiltered($cellRangeAddress))) {
$this->_phpSheet->mergeCells($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 // 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); $url = self::_encodeUTF16(substr($recordData, $offset, $us - 2), false);
$nullOffset = strpos($url, 0x00); $nullOffset = strpos($url, 0x00);
if ($nullOffset) if ($nullOffset) {
$url = substr($url,0, $nullOffset); $url = substr($url, 0, $nullOffset);
}
$url .= $hasText ? '#' : ''; $url .= $hasText ? '#' : '';
$offset += $us; $offset += $us;
break; 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 * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
* @return string Human readable formula * @return string Human readable formula
*/ */
private function _getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1') private function _getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1')
{ {
// start parsing the formula data // start parsing the formula data
$tokens = array(); $tokens = array();
@ -7468,13 +7468,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$mantissa = (0x100000 | ($rknumhigh & 0x000fffff)); $mantissa = (0x100000 | ($rknumhigh & 0x000fffff));
$mantissalow1 = ($rknumlow & 0x80000000) >> 31; $mantissalow1 = ($rknumlow & 0x80000000) >> 31;
$mantissalow2 = ($rknumlow & 0x7fffffff); $mantissalow2 = ($rknumlow & 0x7fffffff);
$value = $mantissa / pow(2 , (20 - $exp)); $value = $mantissa / pow(2, (20 - $exp));
if ($mantissalow1 != 0) { 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) { if ($sign) {
$value *= -1; $value *= -1;
} }
@ -7496,7 +7496,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$sign = ($rknum & 0x80000000) >> 31; $sign = ($rknum & 0x80000000) >> 31;
$exp = ($rknum & 0x7ff00000) >> 20; $exp = ($rknum & 0x7ff00000) >> 20;
$mantissa = (0x100000 | ($rknum & 0x000ffffc)); $mantissa = (0x100000 | ($rknum & 0x000ffffc));
$value = $mantissa / pow(2 , (20- ($exp - 1023))); $value = $mantissa / pow(2, (20- ($exp - 1023)));
if ($sign) { if ($sign) {
$value = -1 * $value; $value = -1 * $value;
} }
@ -7520,7 +7520,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
{ {
if ($compressed) { if ($compressed) {
$string = self::_uncompressByteString($string); $string = self::_uncompressByteString($string);
} }
return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', 'UTF-16LE'); return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', 'UTF-16LE');
} }

View File

@ -115,7 +115,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$xml = new XMLReader(); $xml = new XMLReader();
$xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions()); $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
$xml->setParserProperty(2,true); $xml->setParserProperty(2, true);
$worksheetNames = array(); $worksheetNames = array();
while ($xml->read()) { while ($xml->read()) {
@ -467,7 +467,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
if ((!$this->_readDataOnly) && (isset($sheet->Objects))) { 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(); $commentAttributes = $comment->attributes();
// Only comment objects are handled at the moment // Only comment objects are handled at the moment
if ($commentAttributes->Text) { if ($commentAttributes->Text) {
@ -481,7 +481,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$styleAttributes = $styleRegion->attributes(); $styleAttributes = $styleRegion->attributes();
if (($styleAttributes['startRow'] <= $maxRow) && if (($styleAttributes['startRow'] <= $maxRow) &&
($styleAttributes['startCol'] <= $maxCol)) { ($styleAttributes['startCol'] <= $maxCol)) {
$startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']); $startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']);
$startRow = $styleAttributes['startRow'] + 1; $startRow = $styleAttributes['startRow'] + 1;
@ -748,7 +747,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// Handle Merged Cells in this worksheet // Handle Merged Cells in this worksheet
if (isset($sheet->MergedRegions)) { if (isset($sheet->MergedRegions)) {
foreach ($sheet->MergedRegions->Merge as $mergeCells) { foreach ($sheet->MergedRegions->Merge as $mergeCells) {
if (strpos($mergeCells,':') !== false) { if (strpos($mergeCells, ':') !== false) {
$objPHPExcel->getActiveSheet()->mergeCells($mergeCells); $objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
} }
} }
@ -767,7 +766,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
$range = explode('!', $range); $range = explode('!', $range);
$range[0] = trim($range[0],"'");; $range[0] = trim($range[0], "'");
if ($worksheet = $objPHPExcel->getSheetByName($range[0])) { if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
$extractedRange = str_replace('$', '', $range[1]); $extractedRange = str_replace('$', '', $range[1]);
$objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $worksheet, $extractedRange)); $objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $worksheet, $extractedRange));
@ -844,7 +843,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $value; return $value;
} }
private static function _parseGnumericColour($gnmColour) { private static function _parseGnumericColour($gnmColour)
{
list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour); list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour);
$gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2); $gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2);
$gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2); $gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2);

View File

@ -54,7 +54,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
/** /**
* Create a new PHPExcel_Reader_OOCalc * Create a new PHPExcel_Reader_OOCalc
*/ */
public function __construct() { public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $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); return $this->loadIntoExisting($pFilename, $objPHPExcel);
} }
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) private static function identifyFixedStyleValue($styleList, &$styleAttributeValue)
{ {
$styleAttributeValue = strtolower($styleAttributeValue); $styleAttributeValue = strtolower($styleAttributeValue);
foreach ($styleList as $style) { foreach ($styleList as $style) {
@ -358,22 +359,22 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
foreach ($officePropertyDC as $propertyName => $propertyValue) { foreach ($officePropertyDC as $propertyName => $propertyValue) {
$propertyValue = (string) $propertyValue; $propertyValue = (string) $propertyValue;
switch ($propertyName) { switch ($propertyName) {
case 'title' : case 'title':
$docProps->setTitle($propertyValue); $docProps->setTitle($propertyValue);
break; break;
case 'subject' : case 'subject':
$docProps->setSubject($propertyValue); $docProps->setSubject($propertyValue);
break; break;
case 'creator' : case 'creator':
$docProps->setCreator($propertyValue); $docProps->setCreator($propertyValue);
$docProps->setLastModifiedBy($propertyValue); $docProps->setLastModifiedBy($propertyValue);
break; break;
case 'date' : case 'date':
$creationDate = strtotime($propertyValue); $creationDate = strtotime($propertyValue);
$docProps->setCreated($creationDate); $docProps->setCreated($creationDate);
$docProps->setModified($creationDate); $docProps->setModified($creationDate);
break; break;
case 'description' : case 'description':
$docProps->setDescription($propertyValue); $docProps->setDescription($propertyValue);
break; break;
} }
@ -386,36 +387,36 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']); $propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
$propertyValue = (string) $propertyValue; $propertyValue = (string) $propertyValue;
switch ($propertyName) { switch ($propertyName) {
case 'initial-creator' : case 'initial-creator':
$docProps->setCreator($propertyValue); $docProps->setCreator($propertyValue);
break; break;
case 'keyword' : case 'keyword':
$docProps->setKeywords($propertyValue); $docProps->setKeywords($propertyValue);
break; break;
case 'creation-date' : case 'creation-date':
$creationDate = strtotime($propertyValue); $creationDate = strtotime($propertyValue);
$docProps->setCreated($creationDate); $docProps->setCreated($creationDate);
break; break;
case 'user-defined' : case 'user-defined':
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
foreach ($propertyValueAttributes as $key => $value) { foreach ($propertyValueAttributes as $key => $value) {
if ($key == 'name') { if ($key == 'name') {
$propertyValueName = (string) $value; $propertyValueName = (string) $value;
} elseif ($key == 'value-type') { } elseif ($key == 'value-type') {
switch ($value) { switch ($value) {
case 'date' : case 'date':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'date'); $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'date');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE; $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
break; break;
case 'boolean' : case 'boolean':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'bool'); $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'bool');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN; $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
break; break;
case 'float' : case 'float':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'r4'); $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'r4');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT; $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
break; break;
default : default:
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; $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 // 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 // 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 // bringing the worksheet name in line with the formula, not the reverse
$objPHPExcel->getActiveSheet()->setTitle($worksheetName,false); $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
} }
$rowID = 1; $rowID = 1;
@ -471,10 +472,9 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$rowData = $cellData; $rowData = $cellData;
break; break;
} }
case 'table-row' : case 'table-row':
$rowDataTableAttributes = $rowData->attributes($namespacesContent['table']); $rowDataTableAttributes = $rowData->attributes($namespacesContent['table']);
$rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? $rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? $rowDataTableAttributes['number-rows-repeated'] : 1;
$rowDataTableAttributes['number-rows-repeated'] : 1;
$columnID = 'A'; $columnID = 'A';
foreach ($rowData as $key => $cellData) { foreach ($rowData as $key => $cellData) {
if ($this->getReadFilter() !== null) { if ($this->getReadFilter() !== null) {
@ -484,9 +484,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
} }
// echo '<b>'.$columnID.$rowID.'</b><br />'; // echo '<b>'.$columnID.$rowID.'</b><br />';
$cellDataText = (isset($namespacesContent['text'])) ? $cellDataText = (isset($namespacesContent['text'])) ? $cellData->children($namespacesContent['text']) : '';
$cellData->children($namespacesContent['text']) :
'';
$cellDataOffice = $cellData->children($namespacesContent['office']); $cellDataOffice = $cellData->children($namespacesContent['office']);
$cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']); $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
$cellDataTableAttributes = $cellData->attributes($namespacesContent['table']); $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
@ -522,9 +520,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
} }
$text = implode("\n", $textArray); $text = implode("\n", $textArray);
// echo $text, '<br />'; // echo $text, '<br />';
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID ) $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setText($this->_parseRichText($text));
// ->setAuthor( $author ) // ->setAuthor( $author )
->setText($this->_parseRichText($text) );
} }
if (isset($cellDataText->p)) { 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 />'; // echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
switch ($cellDataOfficeAttributes['value-type']) { switch ($cellDataOfficeAttributes['value-type']) {
case 'string' : case 'string':
$type = PHPExcel_Cell_DataType::TYPE_STRING; $type = PHPExcel_Cell_DataType::TYPE_STRING;
$dataValue = $allCellDataText; $dataValue = $allCellDataText;
if (isset($dataValue->a)) { if (isset($dataValue->a)) {
@ -559,11 +556,11 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$hyperlink = $cellXLinkAttributes['href']; $hyperlink = $cellXLinkAttributes['href'];
} }
break; break;
case 'boolean' : case 'boolean':
$type = PHPExcel_Cell_DataType::TYPE_BOOL; $type = PHPExcel_Cell_DataType::TYPE_BOOL;
$dataValue = ($allCellDataText == 'TRUE') ? true : false; $dataValue = ($allCellDataText == 'TRUE') ? true : false;
break; break;
case 'percentage' : case 'percentage':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value']; $dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) { 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; $formatting = PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00;
break; break;
case 'currency' : case 'currency':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value']; $dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) { 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; $formatting = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
break; break;
case 'float' : case 'float':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value']; $dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) { if (floor($dataValue) == $dataValue) {
if ($dataValue == (integer) $dataValue) if ($dataValue == (integer) $dataValue) {
$dataValue = (integer) $dataValue; $dataValue = (integer) $dataValue;
else } else {
$dataValue = (float) $dataValue; $dataValue = (float) $dataValue;
}
} }
break; break;
case 'date' : case 'date':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT); $dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT);
$dateObj->setTimeZone($timezoneObj); $dateObj->setTimeZone($timezoneObj);
@ -601,9 +599,9 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15; $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15;
} }
break; break;
case 'time' : case 'time':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $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; $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
break; break;
} }
@ -619,7 +617,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
if ($hasCalculatedValue) { if ($hasCalculatedValue) {
$type = PHPExcel_Cell_DataType::TYPE_FORMULA; $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
// echo 'Formula: ', $cellDataFormula, PHP_EOL; // echo 'Formula: ', $cellDataFormula, PHP_EOL;
$cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula, ':=')+1); $cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=')+1);
$temp = explode('"', $cellDataFormula); $temp = explode('"', $cellDataFormula);
$tKey = false; $tKey = false;
foreach ($temp as &$value) { foreach ($temp as &$value) {

View File

@ -269,7 +269,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
$formatArray['font']['size'] = substr($rowDatum, 1); $formatArray['font']['size'] = substr($rowDatum, 1);
break; break;
case 'S': case 'S':
$styleSettings = substr($rowDatum,1); $styleSettings = substr($rowDatum, 1);
for ($i=0; $i<strlen($styleSettings); ++$i) { for ($i=0; $i<strlen($styleSettings); ++$i) {
switch ($styleSettings{$i}) { switch ($styleSettings{$i}) {
case 'I': case 'I':

View File

@ -72,7 +72,7 @@ class EigenvalueDecomposition
* *
* @access private * @access private
*/ */
private function tred2 () private function tred2()
{ {
// This is derived from the Algol procedures tred2 by // This is derived from the Algol procedures tred2 by
// Bowdler, Martin, Reinsch, and Wilkinson, Handbook for // Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
@ -189,7 +189,7 @@ class EigenvalueDecomposition
$this->e[$this->n-1] = 0.0; $this->e[$this->n-1] = 0.0;
$f = 0.0; $f = 0.0;
$tst1 = 0.0; $tst1 = 0.0;
$eps = pow(2.0,-52.0); $eps = pow(2.0, -52.0);
for ($l = 0; $l < $this->n; ++$l) { for ($l = 0; $l < $this->n; ++$l) {
// Find small subdiagonal element // Find small subdiagonal element
@ -741,7 +741,7 @@ class EigenvalueDecomposition
} }
} }
// Overflow control // 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) { if (($eps * $t) * $t > 1) {
for ($j = $i; $j <= $n; ++$j) { for ($j = $i; $j <= $n; ++$j) {
$this->H[$j][$n-1] = $this->H[$j][$n-1] / $t; $this->H[$j][$n-1] = $this->H[$j][$n-1] / $t;

View File

@ -95,8 +95,8 @@ class PHPExcel_Shared_JAMA_Matrix
$this->n = 0; $this->n = 0;
} }
if (($this->m * $this->n) == count($args[0])) { if (($this->m * $this->n) == count($args[0])) {
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$this->A[$i][$j] = $args[0][$i + $j * $this->m]; $this->A[$i][$j] = $args[0][$i + $j * $this->m];
} }
} }
@ -176,11 +176,19 @@ class PHPExcel_Shared_JAMA_Matrix
//A($i0...; $j0...) //A($i0...; $j0...)
case 'integer,integer': case 'integer,integer':
list($i0, $j0) = $args; list($i0, $j0) = $args;
if ($i0 >= 0) { $m = $this->m - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } if ($i0 >= 0) {
if ($j0 >= 0) { $n = $this->n - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $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); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = $i0; $i < $this->m; ++$i) { for ($i = $i0; $i < $this->m; ++$i) {
for($j = $j0; $j < $this->n; ++$j) { for ($j = $j0; $j < $this->n; ++$j) {
$R->set($i, $j, $this->A[$i][$j]); $R->set($i, $j, $this->A[$i][$j]);
} }
} }
@ -189,11 +197,15 @@ class PHPExcel_Shared_JAMA_Matrix
//A($i0...$iF; $j0...$jF) //A($i0...$iF; $j0...$jF)
case 'integer,integer,integer,integer': case 'integer,integer,integer,integer':
list($i0, $iF, $j0, $jF) = $args; 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 (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $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); $R = new PHPExcel_Shared_JAMA_Matrix($m+1, $n+1);
for($i = $i0; $i <= $iF; ++$i) { for ($i = $i0; $i <= $iF; ++$i) {
for($j = $j0; $j <= $jF; ++$j) { for ($j = $j0; $j <= $jF; ++$j) {
$R->set($i - $i0, $j - $j0, $this->A[$i][$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 //$R = array of row indices; $C = array of column indices
case 'array,array': case 'array,array':
list($RL, $CL) = $args; list($RL, $CL) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } if (count($RL) > 0) {
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $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); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = 0; $i < $m; ++$i) { for ($i = 0; $i < $m; ++$i) {
for($j = 0; $j < $n; ++$j) { for ($j = 0; $j < $n; ++$j) {
$R->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$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 //$RL = array of row indices; $CL = array of column indices
case 'array,array': case 'array,array':
list($RL, $CL) = $args; list($RL, $CL) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } if (count($RL) > 0) {
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $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); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = 0; $i < $m; ++$i) { for ($i = 0; $i < $m; ++$i) {
for($j = 0; $j < $n; ++$j) { for ($j = 0; $j < $n; ++$j) {
$R->set($i, $j, $this->A[$RL[$i]][$CL[$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 //A($i0...$iF); $CL = array of column indices
case 'integer,integer,array': case 'integer,integer,array':
list($i0, $iF, $CL) = $args; 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 (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $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); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = $i0; $i < $iF; ++$i) { for ($i = $i0; $i < $iF; ++$i) {
for($j = 0; $j < $n; ++$j) { for ($j = 0; $j < $n; ++$j) {
$R->set($i - $i0, $j, $this->A[$RL[$i]][$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 //$RL = array of row indices
case 'array,integer,integer': case 'array,integer,integer':
list($RL, $j0, $jF) = $args; list($RL, $j0, $jF) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } if (count($RL) > 0) {
if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $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); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n+1);
for($i = 0; $i < $m; ++$i) { for ($i = 0; $i < $m; ++$i) {
for($j = $j0; $j <= $jF; ++$j) { for ($j = $j0; $j <= $jF; ++$j) {
$R->set($i, $j - $j0, $this->A[$RL[$i]][$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) public function diagonal($m = null, $n = null, $c = 1)
{ {
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n); $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); $R->set($i, $i, $c);
} }
return $R; return $R;
@ -377,8 +421,8 @@ class PHPExcel_Shared_JAMA_Matrix
public function transpose() public function transpose()
{ {
$R = new PHPExcel_Shared_JAMA_Matrix($this->n, $this->m); $R = new PHPExcel_Shared_JAMA_Matrix($this->n, $this->m);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$R->set($j, $i, $this->A[$i][$j]); $R->set($j, $i, $this->A[$i][$j]);
} }
} }
@ -395,7 +439,7 @@ class PHPExcel_Shared_JAMA_Matrix
{ {
$s = 0; $s = 0;
$n = min($this->m, $this->n); $n = min($this->m, $this->n);
for($i = 0; $i < $n; ++$i) { for ($i = 0; $i < $n; ++$i) {
$s += $this->A[$i][$i]; $s += $this->A[$i][$i];
} }
return $s; return $s;
@ -440,8 +484,8 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]); $M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]);
} }
} }
@ -480,16 +524,16 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$validValues = true; $validValues = true;
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$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]); $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
} }
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value,'"'); $value = trim($value, '"');
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value); $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
} }
if ($validValues) { if ($validValues) {
@ -534,8 +578,8 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$M->set($i, $j, $M->get($i, $j) - $this->A[$i][$j]); $M->set($i, $j, $M->get($i, $j) - $this->A[$i][$j]);
} }
} }
@ -574,16 +618,16 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$validValues = true; $validValues = true;
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$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]); $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
} }
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value,'"'); $value = trim($value, '"');
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value); $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
} }
if ($validValues) { if ($validValues) {
@ -629,8 +673,8 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$M->set($i, $j, $M->get($i, $j) * $this->A[$i][$j]); $M->set($i, $j, $M->get($i, $j) * $this->A[$i][$j]);
} }
} }
@ -670,16 +714,16 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$validValues = true; $validValues = true;
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$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]); $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
} }
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value,'"'); $value = trim($value, '"');
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value); $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
} }
if ($validValues) { if ($validValues) {
@ -725,16 +769,16 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$validValues = true; $validValues = true;
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$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]); $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
} }
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value,'"'); $value = trim($value, '"');
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value); $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
} }
if ($validValues) { if ($validValues) {
@ -786,8 +830,8 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$this->A[$i][$j] = $this->A[$i][$j] / $M->get($i, $j); $this->A[$i][$j] = $this->A[$i][$j] / $M->get($i, $j);
} }
} }
@ -828,8 +872,8 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$M->set($i, $j, $M->get($i, $j) / $this->A[$i][$j]); $M->set($i, $j, $M->get($i, $j) / $this->A[$i][$j]);
} }
} }
@ -870,8 +914,8 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$this->A[$i][$j] = $M->get($i, $j) / $this->A[$i][$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) { if ($this->n == $B->m) {
$C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n); $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) { for ($k = 0; $k < $this->n; ++$k) {
$Bcolj[$k] = $B->A[$k][$j]; $Bcolj[$k] = $B->A[$k][$j];
} }
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
$Arowi = $this->A[$i]; $Arowi = $this->A[$i];
$s = 0; $s = 0;
for($k = 0; $k < $this->n; ++$k) { for ($k = 0; $k < $this->n; ++$k) {
$s += $Arowi[$k] * $Bcolj[$k]; $s += $Arowi[$k] * $Bcolj[$k];
} }
$C->A[$i][$j] = $s; $C->A[$i][$j] = $s;
@ -926,10 +970,10 @@ class PHPExcel_Shared_JAMA_Matrix
$B = new PHPExcel_Shared_JAMA_Matrix($args[0]); $B = new PHPExcel_Shared_JAMA_Matrix($args[0]);
if ($this->n == $B->m) { if ($this->n == $B->m) {
$C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n); $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n);
for($i = 0; $i < $C->m; ++$i) { for ($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) { for ($j = 0; $j < $C->n; ++$j) {
$s = "0"; $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]; $s += $this->A[$i][$k] * $B->A[$k][$j];
} }
$C->A[$i][$j] = $s; $C->A[$i][$j] = $s;
@ -943,8 +987,8 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
case 'integer': case 'integer':
$C = new PHPExcel_Shared_JAMA_Matrix($this->A); $C = new PHPExcel_Shared_JAMA_Matrix($this->A);
for($i = 0; $i < $C->m; ++$i) { for ($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) { for ($j = 0; $j < $C->n; ++$j) {
$C->A[$i][$j] *= $args[0]; $C->A[$i][$j] *= $args[0];
} }
} }
@ -952,8 +996,8 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
case 'double': case 'double':
$C = new PHPExcel_Shared_JAMA_Matrix($this->m, $this->n); $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $this->n);
for($i = 0; $i < $C->m; ++$i) { for ($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) { for ($j = 0; $j < $C->n; ++$j) {
$C->A[$i][$j] = $args[0] * $this->A[$i][$j]; $C->A[$i][$j] = $args[0] * $this->A[$i][$j];
} }
} }
@ -961,8 +1005,8 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
case 'float': case 'float':
$C = new PHPExcel_Shared_JAMA_Matrix($this->A); $C = new PHPExcel_Shared_JAMA_Matrix($this->A);
for($i = 0; $i < $C->m; ++$i) { for ($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) { for ($j = 0; $j < $C->n; ++$j) {
$C->A[$i][$j] *= $args[0]; $C->A[$i][$j] *= $args[0];
} }
} }
@ -1006,16 +1050,16 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$validValues = true; $validValues = true;
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$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]); $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
} }
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value,'"'); $value = trim($value, '"');
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value); $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
} }
if ($validValues) { if ($validValues) {
@ -1059,9 +1103,9 @@ class PHPExcel_Shared_JAMA_Matrix
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$this->A[$i][$j] = trim($this->A[$i][$j],'"').trim($M->get($i, $j),'"'); $this->A[$i][$j] = trim($this->A[$i][$j], '"').trim($M->get($i, $j), '"');
} }
} }
return $this; return $this;

View File

@ -233,4 +233,3 @@ class PHPExcel_Shared_JAMA_QRDecomposition
} }
} // function solve() } // function solve()
} }

View File

@ -266,7 +266,7 @@ class SingularValueDecomposition
break; break;
} }
$t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks-1]) : 0.); $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; $this->s[$ks] = 0.0;
break; break;
} }

View File

@ -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_dir = PHPExcel_Shared_File::sys_get_temp_dir();
} }
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root"); $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) { if ($this->_FILEH_ == false) {
throw new PHPExcel_Writer_Exception("Can't create temporary file."); 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", 0x1000)
. pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot . pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
. pack("V", $iSBDcnt) . pack("V", $iSBDcnt)
); );
// Extra BDList Start, Count // Extra BDList Start, Count
if ($iBdCnt < $i1stBdL) { if ($iBdCnt < $i1stBdL) {
fwrite( fwrite(

View File

@ -3458,7 +3458,6 @@ class PclZip
} }
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
// ----- Change the file status // ----- Change the file status
$p_entry['status'] = "path_creation_fail"; $p_entry['status'] = "path_creation_fail";

View File

@ -15,452 +15,452 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
/** /**
* @dataProvider providerDATE * @dataProvider providerDATE
*/ */
public function testDATE() public function testDATE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDATE() public function providerDATE()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATE.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/DATE.data');
} }
public function testDATEtoPHP() public function testDATEtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31); $result = PHPExcel_Calculation_DateTime::DATE(2012,1,31);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1327968000, $result, NULL, 1E-8); $this->assertEquals(1327968000, $result, null, 1E-8);
} }
public function testDATEtoPHPObject() public function testDATEtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31); $result = PHPExcel_Calculation_DateTime::DATE(2012,1,31);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result,'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Jan-2012'); $this->assertEquals($result->format('d-M-Y'),'31-Jan-2012');
} }
public function testDATEwith1904Calendar() public function testDATEwith1904Calendar()
{ {
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
$result = PHPExcel_Calculation_DateTime::DATE(1918,11,11); $result = PHPExcel_Calculation_DateTime::DATE(1918,11,11);
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
$this->assertEquals($result,5428); $this->assertEquals($result,5428);
} }
public function testDATEwith1904CalendarError() public function testDATEwith1904CalendarError()
{ {
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
$result = PHPExcel_Calculation_DateTime::DATE(1901,1,31); $result = PHPExcel_Calculation_DateTime::DATE(1901,1,31);
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
$this->assertEquals($result,'#NUM!'); $this->assertEquals($result,'#NUM!');
} }
/** /**
* @dataProvider providerDATEVALUE * @dataProvider providerDATEVALUE
*/ */
public function testDATEVALUE() public function testDATEVALUE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEVALUE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEVALUE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDATEVALUE() public function providerDATEVALUE()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEVALUE.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEVALUE.data');
} }
public function testDATEVALUEtoPHP() public function testDATEVALUEtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31'); $result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1327968000, $result, NULL, 1E-8); $this->assertEquals(1327968000, $result, null, 1E-8);
} }
public function testDATEVALUEtoPHPObject() public function testDATEVALUEtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31'); $result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result,'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Jan-2012'); $this->assertEquals($result->format('d-M-Y'),'31-Jan-2012');
} }
/** /**
* @dataProvider providerYEAR * @dataProvider providerYEAR
*/ */
public function testYEAR() public function testYEAR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEAR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEAR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerYEAR() public function providerYEAR()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/YEAR.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/YEAR.data');
} }
/** /**
* @dataProvider providerMONTH * @dataProvider providerMONTH
*/ */
public function testMONTH() public function testMONTH()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MONTHOFYEAR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MONTHOFYEAR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerMONTH() public function providerMONTH()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/MONTH.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/MONTH.data');
} }
/** /**
* @dataProvider providerWEEKNUM * @dataProvider providerWEEKNUM
*/ */
public function testWEEKNUM() public function testWEEKNUM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WEEKOFYEAR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WEEKOFYEAR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerWEEKNUM() public function providerWEEKNUM()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKNUM.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKNUM.data');
} }
/** /**
* @dataProvider providerWEEKDAY * @dataProvider providerWEEKDAY
*/ */
public function testWEEKDAY() public function testWEEKDAY()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFWEEK'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFWEEK'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerWEEKDAY() public function providerWEEKDAY()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKDAY.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKDAY.data');
} }
/** /**
* @dataProvider providerDAY * @dataProvider providerDAY
*/ */
public function testDAY() public function testDAY()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFMONTH'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFMONTH'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDAY() public function providerDAY()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/DAY.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/DAY.data');
} }
/** /**
* @dataProvider providerTIME * @dataProvider providerTIME
*/ */
public function testTIME() public function testTIME()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIME'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIME'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerTIME() public function providerTIME()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/TIME.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/TIME.data');
} }
public function testTIMEtoPHP() public function testTIMEtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20); $result = PHPExcel_Calculation_DateTime::TIME(7,30,20);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(27020, $result, NULL, 1E-8); $this->assertEquals(27020, $result, null, 1E-8);
} }
public function testTIMEtoPHPObject() public function testTIMEtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20); $result = PHPExcel_Calculation_DateTime::TIME(7,30,20);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result,'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('H:i:s'),'07:30:20'); $this->assertEquals($result->format('H:i:s'),'07:30:20');
} }
/** /**
* @dataProvider providerTIMEVALUE * @dataProvider providerTIMEVALUE
*/ */
public function testTIMEVALUE() public function testTIMEVALUE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIMEVALUE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIMEVALUE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerTIMEVALUE() public function providerTIMEVALUE()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/TIMEVALUE.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/TIMEVALUE.data');
} }
public function testTIMEVALUEtoPHP() public function testTIMEVALUEtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20'); $result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(23420, $result, NULL, 1E-8); $this->assertEquals(23420, $result, null, 1E-8);
} }
public function testTIMEVALUEtoPHPObject() public function testTIMEVALUEtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20'); $result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result,'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('H:i:s'),'07:30:20'); $this->assertEquals($result->format('H:i:s'),'07:30:20');
} }
/** /**
* @dataProvider providerHOUR * @dataProvider providerHOUR
*/ */
public function testHOUR() public function testHOUR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','HOUROFDAY'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','HOUROFDAY'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerHOUR() public function providerHOUR()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/HOUR.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/HOUR.data');
} }
/** /**
* @dataProvider providerMINUTE * @dataProvider providerMINUTE
*/ */
public function testMINUTE() public function testMINUTE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MINUTEOFHOUR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MINUTEOFHOUR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerMINUTE() public function providerMINUTE()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/MINUTE.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/MINUTE.data');
} }
/** /**
* @dataProvider providerSECOND * @dataProvider providerSECOND
*/ */
public function testSECOND() public function testSECOND()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','SECONDOFMINUTE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','SECONDOFMINUTE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerSECOND() public function providerSECOND()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/SECOND.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/SECOND.data');
} }
/** /**
* @dataProvider providerNETWORKDAYS * @dataProvider providerNETWORKDAYS
*/ */
public function testNETWORKDAYS() public function testNETWORKDAYS()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','NETWORKDAYS'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','NETWORKDAYS'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNETWORKDAYS() public function providerNETWORKDAYS()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/NETWORKDAYS.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/NETWORKDAYS.data');
} }
/** /**
* @dataProvider providerWORKDAY * @dataProvider providerWORKDAY
*/ */
public function testWORKDAY() public function testWORKDAY()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WORKDAY'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WORKDAY'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerWORKDAY() public function providerWORKDAY()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/WORKDAY.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/WORKDAY.data');
} }
/** /**
* @dataProvider providerEDATE * @dataProvider providerEDATE
*/ */
public function testEDATE() public function testEDATE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EDATE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EDATE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerEDATE() public function providerEDATE()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/EDATE.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/EDATE.data');
} }
public function testEDATEtoPHP() public function testEDATEtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1); $result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1324857600, $result, NULL, 1E-8); $this->assertEquals(1324857600, $result, null, 1E-8);
} }
public function testEDATEtoPHPObject() public function testEDATEtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1); $result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result,'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'26-Dec-2011'); $this->assertEquals($result->format('d-M-Y'),'26-Dec-2011');
} }
/** /**
* @dataProvider providerEOMONTH * @dataProvider providerEOMONTH
*/ */
public function testEOMONTH() public function testEOMONTH()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EOMONTH'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EOMONTH'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerEOMONTH() public function providerEOMONTH()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/EOMONTH.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/EOMONTH.data');
} }
public function testEOMONTHtoPHP() public function testEOMONTHtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1); $result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1325289600, $result, NULL, 1E-8); $this->assertEquals(1325289600, $result, null, 1E-8);
} }
public function testEOMONTHtoPHPObject() public function testEOMONTHtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1); $result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result,'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Dec-2011'); $this->assertEquals($result->format('d-M-Y'),'31-Dec-2011');
} }
/** /**
* @dataProvider providerDATEDIF * @dataProvider providerDATEDIF
*/ */
public function testDATEDIF() public function testDATEDIF()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEDIF'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEDIF'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDATEDIF() public function providerDATEDIF()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEDIF.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEDIF.data');
} }
/** /**
* @dataProvider providerDAYS360 * @dataProvider providerDAYS360
*/ */
public function testDAYS360() public function testDAYS360()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYS360'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYS360'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDAYS360() public function providerDAYS360()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/DAYS360.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/DAYS360.data');
} }
/** /**
* @dataProvider providerYEARFRAC * @dataProvider providerYEARFRAC
*/ */
public function testYEARFRAC() public function testYEARFRAC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEARFRAC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEARFRAC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerYEARFRAC() 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

View File

@ -15,502 +15,502 @@ class FinancialTest extends PHPUnit_Framework_TestCase
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
/** /**
* @dataProvider providerACCRINT * @dataProvider providerACCRINT
*/ */
public function testACCRINT() public function testACCRINT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerACCRINT() public function providerACCRINT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINT.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINT.data');
} }
/** /**
* @dataProvider providerACCRINTM * @dataProvider providerACCRINTM
*/ */
public function testACCRINTM() public function testACCRINTM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINTM'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINTM'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerACCRINTM() public function providerACCRINTM()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINTM.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINTM.data');
} }
/** /**
* @dataProvider providerAMORDEGRC * @dataProvider providerAMORDEGRC
*/ */
public function testAMORDEGRC() public function testAMORDEGRC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORDEGRC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORDEGRC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerAMORDEGRC() public function providerAMORDEGRC()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/AMORDEGRC.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/AMORDEGRC.data');
} }
/** /**
* @dataProvider providerAMORLINC * @dataProvider providerAMORLINC
*/ */
public function testAMORLINC() public function testAMORLINC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORLINC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORLINC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerAMORLINC() public function providerAMORLINC()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/AMORLINC.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/AMORLINC.data');
} }
/** /**
* @dataProvider providerCOUPDAYBS * @dataProvider providerCOUPDAYBS
*/ */
public function testCOUPDAYBS() public function testCOUPDAYBS()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYBS'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYBS'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPDAYBS() public function providerCOUPDAYBS()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYBS.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYBS.data');
} }
/** /**
* @dataProvider providerCOUPDAYS * @dataProvider providerCOUPDAYS
*/ */
public function testCOUPDAYS() public function testCOUPDAYS()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYS'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYS'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPDAYS() public function providerCOUPDAYS()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYS.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYS.data');
} }
/** /**
* @dataProvider providerCOUPDAYSNC * @dataProvider providerCOUPDAYSNC
*/ */
public function testCOUPDAYSNC() public function testCOUPDAYSNC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYSNC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYSNC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPDAYSNC() public function providerCOUPDAYSNC()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYSNC.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYSNC.data');
} }
/** /**
* @dataProvider providerCOUPNCD * @dataProvider providerCOUPNCD
*/ */
public function testCOUPNCD() public function testCOUPNCD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNCD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNCD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPNCD() public function providerCOUPNCD()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNCD.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNCD.data');
} }
/** /**
* @dataProvider providerCOUPNUM * @dataProvider providerCOUPNUM
*/ */
public function testCOUPNUM() public function testCOUPNUM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNUM'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNUM'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPNUM() public function providerCOUPNUM()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNUM.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNUM.data');
} }
/** /**
* @dataProvider providerCOUPPCD * @dataProvider providerCOUPPCD
*/ */
public function testCOUPPCD() public function testCOUPPCD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPPCD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPPCD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPPCD() public function providerCOUPPCD()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPPCD.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPPCD.data');
} }
/** /**
* @dataProvider providerCUMIPMT * @dataProvider providerCUMIPMT
*/ */
public function testCUMIPMT() public function testCUMIPMT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMIPMT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMIPMT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCUMIPMT() public function providerCUMIPMT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/CUMIPMT.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/CUMIPMT.data');
} }
/** /**
* @dataProvider providerCUMPRINC * @dataProvider providerCUMPRINC
*/ */
public function testCUMPRINC() public function testCUMPRINC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMPRINC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMPRINC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCUMPRINC() public function providerCUMPRINC()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/CUMPRINC.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/CUMPRINC.data');
} }
/** /**
* @dataProvider providerDB * @dataProvider providerDB
*/ */
public function testDB() public function testDB()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DB'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DB'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDB() public function providerDB()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/DB.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/DB.data');
} }
/** /**
* @dataProvider providerDDB * @dataProvider providerDDB
*/ */
public function testDDB() public function testDDB()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DDB'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DDB'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDDB() public function providerDDB()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/DDB.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/DDB.data');
} }
/** /**
* @dataProvider providerDISC * @dataProvider providerDISC
*/ */
public function testDISC() public function testDISC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DISC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DISC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDISC() public function providerDISC()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/DISC.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/DISC.data');
} }
/** /**
* @dataProvider providerDOLLARDE * @dataProvider providerDOLLARDE
*/ */
public function testDOLLARDE() public function testDOLLARDE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARDE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARDE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDOLLARDE() public function providerDOLLARDE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARDE.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARDE.data');
} }
/** /**
* @dataProvider providerDOLLARFR * @dataProvider providerDOLLARFR
*/ */
public function testDOLLARFR() public function testDOLLARFR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARFR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARFR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDOLLARFR() public function providerDOLLARFR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARFR.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARFR.data');
} }
/** /**
* @dataProvider providerEFFECT * @dataProvider providerEFFECT
*/ */
public function testEFFECT() public function testEFFECT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerEFFECT() public function providerEFFECT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/EFFECT.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/EFFECT.data');
} }
/** /**
* @dataProvider providerFV * @dataProvider providerFV
*/ */
public function testFV() public function testFV()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerFV() public function providerFV()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/FV.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/FV.data');
} }
/** /**
* @dataProvider providerFVSCHEDULE * @dataProvider providerFVSCHEDULE
*/ */
public function testFVSCHEDULE() public function testFVSCHEDULE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerFVSCHEDULE() public function providerFVSCHEDULE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/FVSCHEDULE.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/FVSCHEDULE.data');
} }
/** /**
* @dataProvider providerINTRATE * @dataProvider providerINTRATE
*/ */
public function testINTRATE() public function testINTRATE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerINTRATE() public function providerINTRATE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/INTRATE.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/INTRATE.data');
} }
/** /**
* @dataProvider providerIPMT * @dataProvider providerIPMT
*/ */
public function testIPMT() public function testIPMT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIPMT() public function providerIPMT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/IPMT.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/IPMT.data');
} }
/** /**
* @dataProvider providerIRR * @dataProvider providerIRR
*/ */
public function testIRR() public function testIRR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIRR() public function providerIRR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/IRR.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/IRR.data');
} }
/** /**
* @dataProvider providerISPMT * @dataProvider providerISPMT
*/ */
public function testISPMT() public function testISPMT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerISPMT() public function providerISPMT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/ISPMT.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/ISPMT.data');
} }
/** /**
* @dataProvider providerMIRR * @dataProvider providerMIRR
*/ */
public function testMIRR() public function testMIRR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','MIRR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','MIRR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerMIRR() public function providerMIRR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/MIRR.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/MIRR.data');
} }
/** /**
* @dataProvider providerNOMINAL * @dataProvider providerNOMINAL
*/ */
public function testNOMINAL() public function testNOMINAL()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NOMINAL'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NOMINAL'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNOMINAL() public function providerNOMINAL()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/NOMINAL.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/NOMINAL.data');
} }
/** /**
* @dataProvider providerNPER * @dataProvider providerNPER
*/ */
public function testNPER() public function testNPER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPER'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPER'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNPER() public function providerNPER()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/NPER.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/NPER.data');
} }
/** /**
* @dataProvider providerNPV * @dataProvider providerNPV
*/ */
public function testNPV() public function testNPV()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPV'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPV'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNPV() public function providerNPV()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/NPV.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/NPV.data');
} }
/** /**
* @dataProvider providerPRICE * @dataProvider providerPRICE
*/ */
public function testPRICE() public function testPRICE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','PRICE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','PRICE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerPRICE() public function providerPRICE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/PRICE.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/PRICE.data');
} }
/** /**
* @dataProvider providerRATE * @dataProvider providerRATE
*/ */
public function testRATE() public function testRATE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','RATE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','RATE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerRATE() public function providerRATE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/RATE.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/RATE.data');
} }
/** /**
* @dataProvider providerXIRR * @dataProvider providerXIRR
*/ */
public function testXIRR() public function testXIRR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','XIRR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','XIRR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerXIRR() public function providerXIRR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/XIRR.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/XIRR.data');
} }
} }

View File

@ -15,262 +15,262 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
public function testDUMMY() public function testDUMMY()
{ {
$result = PHPExcel_Calculation_Functions::DUMMY(); $result = PHPExcel_Calculation_Functions::DUMMY();
$this->assertEquals('#Not Yet Implemented', $result); $this->assertEquals('#Not Yet Implemented', $result);
} }
public function testDIV0() public function testDIV0()
{ {
$result = PHPExcel_Calculation_Functions::DIV0(); $result = PHPExcel_Calculation_Functions::DIV0();
$this->assertEquals('#DIV/0!', $result); $this->assertEquals('#DIV/0!', $result);
} }
public function testNA() public function testNA()
{ {
$result = PHPExcel_Calculation_Functions::NA(); $result = PHPExcel_Calculation_Functions::NA();
$this->assertEquals('#N/A', $result); $this->assertEquals('#N/A', $result);
} }
public function testNaN() public function testNaN()
{ {
$result = PHPExcel_Calculation_Functions::NaN(); $result = PHPExcel_Calculation_Functions::NaN();
$this->assertEquals('#NUM!', $result); $this->assertEquals('#NUM!', $result);
} }
public function testNAME() public function testNAME()
{ {
$result = PHPExcel_Calculation_Functions::NAME(); $result = PHPExcel_Calculation_Functions::NAME();
$this->assertEquals('#NAME?', $result); $this->assertEquals('#NAME?', $result);
} }
public function testREF() public function testREF()
{ {
$result = PHPExcel_Calculation_Functions::REF(); $result = PHPExcel_Calculation_Functions::REF();
$this->assertEquals('#REF!', $result); $this->assertEquals('#REF!', $result);
} }
public function testNULL() public function testNULL()
{ {
$result = PHPExcel_Calculation_Functions::NULL(); $result = PHPExcel_Calculation_Functions::null();
$this->assertEquals('#NULL!', $result); $this->assertEquals('#NULL!', $result);
} }
public function testVALUE() public function testVALUE()
{ {
$result = PHPExcel_Calculation_Functions::VALUE(); $result = PHPExcel_Calculation_Functions::VALUE();
$this->assertEquals('#VALUE!', $result); $this->assertEquals('#VALUE!', $result);
} }
/** /**
* @dataProvider providerIS_BLANK * @dataProvider providerIS_BLANK
*/ */
public function testIS_BLANK() public function testIS_BLANK()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_BLANK'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_BLANK'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_BLANK() 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 * @dataProvider providerIS_ERR
*/ */
public function testIS_ERR() public function testIS_ERR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_ERR() 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 * @dataProvider providerIS_ERROR
*/ */
public function testIS_ERROR() public function testIS_ERROR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERROR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERROR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_ERROR() 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 * @dataProvider providerERROR_TYPE
*/ */
public function testERROR_TYPE() public function testERROR_TYPE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','ERROR_TYPE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','ERROR_TYPE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerERROR_TYPE() 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 * @dataProvider providerIS_LOGICAL
*/ */
public function testIS_LOGICAL() public function testIS_LOGICAL()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_LOGICAL'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_LOGICAL'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_LOGICAL() 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 * @dataProvider providerIS_NA
*/ */
public function testIS_NA() public function testIS_NA()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NA'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NA'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_NA() 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 * @dataProvider providerIS_NUMBER
*/ */
public function testIS_NUMBER() public function testIS_NUMBER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NUMBER'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NUMBER'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_NUMBER() 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 * @dataProvider providerIS_TEXT
*/ */
public function testIS_TEXT() public function testIS_TEXT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_TEXT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_TEXT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_TEXT() 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 * @dataProvider providerIS_NONTEXT
*/ */
public function testIS_NONTEXT() public function testIS_NONTEXT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NONTEXT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NONTEXT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_NONTEXT() 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 * @dataProvider providerIS_EVEN
*/ */
public function testIS_EVEN() public function testIS_EVEN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_EVEN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_EVEN'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_EVEN() 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 * @dataProvider providerIS_ODD
*/ */
public function testIS_ODD() public function testIS_ODD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ODD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ODD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_ODD() public function providerIS_ODD()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ODD.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ODD.data');
} }
/** /**
* @dataProvider providerTYPE * @dataProvider providerTYPE
*/ */
public function testTYPE() public function testTYPE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','TYPE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','TYPE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerTYPE() public function providerTYPE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/TYPE.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/TYPE.data');
} }
/** /**
* @dataProvider providerN * @dataProvider providerN
*/ */
public function testN() public function testN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','N'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','N'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerN() public function providerN()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/N.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/N.data');
} }
} }

View File

@ -15,98 +15,98 @@ class LogicalTest extends PHPUnit_Framework_TestCase
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
public function testTRUE() public function testTRUE()
{ {
$result = PHPExcel_Calculation_Logical::TRUE(); $result = PHPExcel_Calculation_Logical::TRUE();
$this->assertEquals(TRUE, $result); $this->assertEquals(true, $result);
} }
public function testFALSE() public function testFALSE()
{ {
$result = PHPExcel_Calculation_Logical::FALSE(); $result = PHPExcel_Calculation_Logical::FALSE();
$this->assertEquals(FALSE, $result); $this->assertEquals(false, $result);
} }
/** /**
* @dataProvider providerAND * @dataProvider providerAND
*/ */
public function testAND() public function testAND()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_AND'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_AND'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerAND() public function providerAND()
{ {
return new testDataFileIterator('rawTestData/Calculation/Logical/AND.data'); return new testDataFileIterator('rawTestData/Calculation/Logical/AND.data');
} }
/** /**
* @dataProvider providerOR * @dataProvider providerOR
*/ */
public function testOR() public function testOR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_OR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_OR'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerOR() public function providerOR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Logical/OR.data'); return new testDataFileIterator('rawTestData/Calculation/Logical/OR.data');
} }
/** /**
* @dataProvider providerNOT * @dataProvider providerNOT
*/ */
public function testNOT() public function testNOT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','NOT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Logical','NOT'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerNOT() public function providerNOT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Logical/NOT.data'); return new testDataFileIterator('rawTestData/Calculation/Logical/NOT.data');
} }
/** /**
* @dataProvider providerIF * @dataProvider providerIF
*/ */
public function testIF() public function testIF()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','STATEMENT_IF'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Logical','STATEMENT_IF'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerIF() public function providerIF()
{ {
return new testDataFileIterator('rawTestData/Calculation/Logical/IF.data'); return new testDataFileIterator('rawTestData/Calculation/Logical/IF.data');
} }
/** /**
* @dataProvider providerIFERROR * @dataProvider providerIFERROR
*/ */
public function testIFERROR() public function testIFERROR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','IFERROR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Logical','IFERROR'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerIFERROR() public function providerIFERROR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Logical/IFERROR.data'); return new testDataFileIterator('rawTestData/Calculation/Logical/IFERROR.data');
} }
} }

View File

@ -15,38 +15,38 @@ class LookupRefTest extends PHPUnit_Framework_TestCase
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
/** /**
* @dataProvider providerHLOOKUP * @dataProvider providerHLOOKUP
*/ */
public function testHLOOKUP() public function testHLOOKUP()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','HLOOKUP'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','HLOOKUP'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerHLOOKUP() public function providerHLOOKUP()
{ {
return new testDataFileIterator('rawTestData/Calculation/LookupRef/HLOOKUP.data'); return new testDataFileIterator('rawTestData/Calculation/LookupRef/HLOOKUP.data');
} }
/** /**
* @dataProvider providerVLOOKUP * @dataProvider providerVLOOKUP
*/ */
public function testVLOOKUP() public function testVLOOKUP()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','VLOOKUP'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','VLOOKUP'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerVLOOKUP() public function providerVLOOKUP()
{ {
return new testDataFileIterator('rawTestData/Calculation/LookupRef/VLOOKUP.data'); return new testDataFileIterator('rawTestData/Calculation/LookupRef/VLOOKUP.data');
} }
} }

View File

@ -15,472 +15,472 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
/** /**
* @dataProvider providerATAN2 * @dataProvider providerATAN2
*/ */
public function testATAN2() public function testATAN2()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerATAN2() public function providerATAN2()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ATAN2.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/ATAN2.data');
} }
/** /**
* @dataProvider providerCEILING * @dataProvider providerCEILING
*/ */
public function testCEILING() public function testCEILING()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerCEILING() public function providerCEILING()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/CEILING.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/CEILING.data');
} }
/** /**
* @dataProvider providerCOMBIN * @dataProvider providerCOMBIN
*/ */
public function testCOMBIN() public function testCOMBIN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerCOMBIN() public function providerCOMBIN()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/COMBIN.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/COMBIN.data');
} }
/** /**
* @dataProvider providerEVEN * @dataProvider providerEVEN
*/ */
public function testEVEN() public function testEVEN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerEVEN() public function providerEVEN()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/EVEN.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/EVEN.data');
} }
/** /**
* @dataProvider providerODD * @dataProvider providerODD
*/ */
public function testODD() public function testODD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerODD() public function providerODD()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ODD.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/ODD.data');
} }
/** /**
* @dataProvider providerFACT * @dataProvider providerFACT
*/ */
public function testFACT() public function testFACT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerFACT() public function providerFACT()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACT.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACT.data');
} }
/** /**
* @dataProvider providerFACTDOUBLE * @dataProvider providerFACTDOUBLE
*/ */
public function testFACTDOUBLE() public function testFACTDOUBLE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerFACTDOUBLE() public function providerFACTDOUBLE()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACTDOUBLE.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACTDOUBLE.data');
} }
/** /**
* @dataProvider providerFLOOR * @dataProvider providerFLOOR
*/ */
public function testFLOOR() public function testFLOOR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerFLOOR() public function providerFLOOR()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FLOOR.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/FLOOR.data');
} }
/** /**
* @dataProvider providerGCD * @dataProvider providerGCD
*/ */
public function testGCD() public function testGCD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerGCD() public function providerGCD()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/GCD.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/GCD.data');
} }
/** /**
* @dataProvider providerLCM * @dataProvider providerLCM
*/ */
public function testLCM() public function testLCM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerLCM() public function providerLCM()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/LCM.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/LCM.data');
} }
/** /**
* @dataProvider providerINT * @dataProvider providerINT
*/ */
public function testINT() public function testINT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','INT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','INT'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerINT() public function providerINT()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/INT.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/INT.data');
} }
/** /**
* @dataProvider providerSIGN * @dataProvider providerSIGN
*/ */
public function testSIGN() public function testSIGN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSIGN() public function providerSIGN()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SIGN.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/SIGN.data');
} }
/** /**
* @dataProvider providerPOWER * @dataProvider providerPOWER
*/ */
public function testPOWER() public function testPOWER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerPOWER() public function providerPOWER()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/POWER.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/POWER.data');
} }
/** /**
* @dataProvider providerLOG * @dataProvider providerLOG
*/ */
public function testLOG() public function testLOG()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerLOG() public function providerLOG()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/LOG.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/LOG.data');
} }
/** /**
* @dataProvider providerMOD * @dataProvider providerMOD
*/ */
public function testMOD() public function testMOD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMOD() public function providerMOD()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MOD.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MOD.data');
} }
/** /**
* @dataProvider providerMDETERM * @dataProvider providerMDETERM
*/ */
public function testMDETERM() public function testMDETERM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMDETERM() public function providerMDETERM()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MDETERM.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MDETERM.data');
} }
/** /**
* @dataProvider providerMINVERSE * @dataProvider providerMINVERSE
*/ */
public function testMINVERSE() public function testMINVERSE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMINVERSE() public function providerMINVERSE()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MINVERSE.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MINVERSE.data');
} }
/** /**
* @dataProvider providerMMULT * @dataProvider providerMMULT
*/ */
public function testMMULT() public function testMMULT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMMULT() public function providerMMULT()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MMULT.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MMULT.data');
} }
/** /**
* @dataProvider providerMULTINOMIAL * @dataProvider providerMULTINOMIAL
*/ */
public function testMULTINOMIAL() public function testMULTINOMIAL()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMULTINOMIAL() public function providerMULTINOMIAL()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MULTINOMIAL.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MULTINOMIAL.data');
} }
/** /**
* @dataProvider providerMROUND * @dataProvider providerMROUND
*/ */
public function testMROUND() public function testMROUND()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'),$args);
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_ARRAY); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_ARRAY);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMROUND() public function providerMROUND()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MROUND.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MROUND.data');
} }
/** /**
* @dataProvider providerPRODUCT * @dataProvider providerPRODUCT
*/ */
public function testPRODUCT() public function testPRODUCT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerPRODUCT() public function providerPRODUCT()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/PRODUCT.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/PRODUCT.data');
} }
/** /**
* @dataProvider providerQUOTIENT * @dataProvider providerQUOTIENT
*/ */
public function testQUOTIENT() public function testQUOTIENT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerQUOTIENT() public function providerQUOTIENT()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/QUOTIENT.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/QUOTIENT.data');
} }
/** /**
* @dataProvider providerROUNDUP * @dataProvider providerROUNDUP
*/ */
public function testROUNDUP() public function testROUNDUP()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerROUNDUP() public function providerROUNDUP()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDUP.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDUP.data');
} }
/** /**
* @dataProvider providerROUNDDOWN * @dataProvider providerROUNDDOWN
*/ */
public function testROUNDDOWN() public function testROUNDDOWN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerROUNDDOWN() public function providerROUNDDOWN()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDDOWN.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDDOWN.data');
} }
/** /**
* @dataProvider providerSERIESSUM * @dataProvider providerSERIESSUM
*/ */
public function testSERIESSUM() public function testSERIESSUM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSERIESSUM() public function providerSERIESSUM()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SERIESSUM.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/SERIESSUM.data');
} }
/** /**
* @dataProvider providerSUMSQ * @dataProvider providerSUMSQ
*/ */
public function testSUMSQ() public function testSUMSQ()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSUMSQ() public function providerSUMSQ()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SUMSQ.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/SUMSQ.data');
} }
/** /**
* @dataProvider providerTRUNC * @dataProvider providerTRUNC
*/ */
public function testTRUNC() public function testTRUNC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerTRUNC() public function providerTRUNC()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/TRUNC.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/TRUNC.data');
} }
/** /**
* @dataProvider providerROMAN * @dataProvider providerROMAN
*/ */
public function testROMAN() public function testROMAN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROMAN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROMAN'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerROMAN() public function providerROMAN()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROMAN.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROMAN.data');
} }
/** /**
* @dataProvider providerSQRTPI * @dataProvider providerSQRTPI
*/ */
public function testSQRTPI() public function testSQRTPI()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSQRTPI() 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(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig', 'SUMIF'), $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() public function providerSUMIF()
@ -555,6 +555,6 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
100 100
), ),
); );
} }
} }

View File

@ -15,351 +15,351 @@ class TextDataTest extends PHPUnit_Framework_TestCase
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
/** /**
* @dataProvider providerCHAR * @dataProvider providerCHAR
*/ */
public function testCHAR() public function testCHAR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CHARACTER'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','CHARACTER'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCHAR() public function providerCHAR()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/CHAR.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/CHAR.data');
} }
/** /**
* @dataProvider providerCODE * @dataProvider providerCODE
*/ */
public function testCODE() public function testCODE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','ASCIICODE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','ASCIICODE'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCODE() public function providerCODE()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/CODE.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/CODE.data');
} }
/** /**
* @dataProvider providerCONCATENATE * @dataProvider providerCONCATENATE
*/ */
public function testCONCATENATE() public function testCONCATENATE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CONCATENATE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','CONCATENATE'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCONCATENATE() public function providerCONCATENATE()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/CONCATENATE.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/CONCATENATE.data');
} }
/** /**
* @dataProvider providerLEFT * @dataProvider providerLEFT
*/ */
public function testLEFT() public function testLEFT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LEFT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','LEFT'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerLEFT() public function providerLEFT()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/LEFT.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/LEFT.data');
} }
/** /**
* @dataProvider providerMID * @dataProvider providerMID
*/ */
public function testMID() public function testMID()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','MID'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','MID'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerMID() public function providerMID()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/MID.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/MID.data');
} }
/** /**
* @dataProvider providerRIGHT * @dataProvider providerRIGHT
*/ */
public function testRIGHT() public function testRIGHT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RIGHT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','RIGHT'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerRIGHT() public function providerRIGHT()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/RIGHT.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/RIGHT.data');
} }
/** /**
* @dataProvider providerLOWER * @dataProvider providerLOWER
*/ */
public function testLOWER() public function testLOWER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LOWERCASE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','LOWERCASE'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerLOWER() public function providerLOWER()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/LOWER.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/LOWER.data');
} }
/** /**
* @dataProvider providerUPPER * @dataProvider providerUPPER
*/ */
public function testUPPER() public function testUPPER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','UPPERCASE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','UPPERCASE'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerUPPER() public function providerUPPER()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/UPPER.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/UPPER.data');
} }
/** /**
* @dataProvider providerPROPER * @dataProvider providerPROPER
*/ */
public function testPROPER() public function testPROPER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','PROPERCASE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','PROPERCASE'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerPROPER() public function providerPROPER()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/PROPER.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/PROPER.data');
} }
/** /**
* @dataProvider providerLEN * @dataProvider providerLEN
*/ */
public function testLEN() public function testLEN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','STRINGLENGTH'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','STRINGLENGTH'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerLEN() public function providerLEN()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/LEN.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/LEN.data');
} }
/** /**
* @dataProvider providerSEARCH * @dataProvider providerSEARCH
*/ */
public function testSEARCH() public function testSEARCH()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHINSENSITIVE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHINSENSITIVE'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerSEARCH() public function providerSEARCH()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/SEARCH.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/SEARCH.data');
} }
/** /**
* @dataProvider providerFIND * @dataProvider providerFIND
*/ */
public function testFIND() public function testFIND()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHSENSITIVE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHSENSITIVE'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerFIND() public function providerFIND()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/FIND.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/FIND.data');
} }
/** /**
* @dataProvider providerREPLACE * @dataProvider providerREPLACE
*/ */
public function testREPLACE() public function testREPLACE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','REPLACE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','REPLACE'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerREPLACE() public function providerREPLACE()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/REPLACE.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/REPLACE.data');
} }
/** /**
* @dataProvider providerSUBSTITUTE * @dataProvider providerSUBSTITUTE
*/ */
public function testSUBSTITUTE() public function testSUBSTITUTE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SUBSTITUTE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','SUBSTITUTE'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerSUBSTITUTE() public function providerSUBSTITUTE()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/SUBSTITUTE.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/SUBSTITUTE.data');
} }
/** /**
* @dataProvider providerTRIM * @dataProvider providerTRIM
*/ */
public function testTRIM() public function testTRIM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMSPACES'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMSPACES'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerTRIM() public function providerTRIM()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/TRIM.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/TRIM.data');
} }
/** /**
* @dataProvider providerCLEAN * @dataProvider providerCLEAN
*/ */
public function testCLEAN() public function testCLEAN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMNONPRINTABLE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMNONPRINTABLE'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCLEAN() public function providerCLEAN()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/CLEAN.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/CLEAN.data');
} }
/** /**
* @dataProvider providerDOLLAR * @dataProvider providerDOLLAR
*/ */
public function testDOLLAR() public function testDOLLAR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','DOLLAR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','DOLLAR'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerDOLLAR() public function providerDOLLAR()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/DOLLAR.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/DOLLAR.data');
} }
/** /**
* @dataProvider providerFIXED * @dataProvider providerFIXED
*/ */
public function testFIXED() public function testFIXED()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','FIXEDFORMAT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','FIXEDFORMAT'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerFIXED() public function providerFIXED()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/FIXED.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/FIXED.data');
} }
/** /**
* @dataProvider providerT * @dataProvider providerT
*/ */
public function testT() public function testT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RETURNSTRING'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','RETURNSTRING'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerT() public function providerT()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/T.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/T.data');
} }
/** /**
* @dataProvider providerTEXT * @dataProvider providerTEXT
*/ */
public function testTEXT() public function testTEXT()
{ {
// Enforce decimal and thousands separator values to UK/US, and currency code to USD // 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','setDecimalSeparator'),'.');
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),','); call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),',');
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$'); call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TEXTFORMAT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','TEXTFORMAT'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerTEXT() public function providerTEXT()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/TEXT.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/TEXT.data');
} }
/** /**
* @dataProvider providerVALUE * @dataProvider providerVALUE
*/ */
public function testVALUE() public function testVALUE()
{ {
call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.'); call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.');
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),' '); call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),' ');
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$'); call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','VALUE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','VALUE'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerVALUE() public function providerVALUE()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/VALUE.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/VALUE.data');
} }
} }

View File

@ -36,12 +36,12 @@ class AdvancedValueBinderTest extends PHPUnit_Framework_TestCase
public function testCurrency($value, $valueBinded, $format, $thousandsSeparator, $decimalSeparator, $currencyCode) public function testCurrency($value, $valueBinded, $format, $thousandsSeparator, $decimalSeparator, $currencyCode)
{ {
$sheet = $this->getMock( $sheet = $this->getMock(
'PHPExcel_Worksheet', 'PHPExcel_Worksheet',
array('getStyle', 'getNumberFormat', 'setFormatCode','getCellCacheController') array('getStyle', 'getNumberFormat', 'setFormatCode','getCellCacheController')
); );
$cache = $this->getMockBuilder('PHPExcel_CachedObjectStorage_Memory') $cache = $this->getMockBuilder('PHPExcel_CachedObjectStorage_Memory')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$cache->expects($this->any()) $cache->expects($this->any())
->method('getParent') ->method('getParent')
->will($this->returnValue($sheet)); ->will($this->returnValue($sheet));
@ -64,7 +64,7 @@ class AdvancedValueBinderTest extends PHPUnit_Framework_TestCase
PHPExcel_Shared_String::setDecimalSeparator($decimalSeparator); PHPExcel_Shared_String::setDecimalSeparator($decimalSeparator);
PHPExcel_Shared_String::setThousandsSeparator($thousandsSeparator); 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 = new PHPExcel_Cell_AdvancedValueBinder();
$binder->bindValue($cell, $value); $binder->bindValue($cell, $value);

View File

@ -11,14 +11,14 @@ class DataTypeTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testGetErrorCodes() public function testGetErrorCodes()
{ {
$result = call_user_func(array('PHPExcel_Cell_DataType','getErrorCodes')); $result = call_user_func(array('PHPExcel_Cell_DataType','getErrorCodes'));
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertGreaterThan(0, count($result)); $this->assertGreaterThan(0, count($result));
$this->assertArrayHasKey('#NULL!', $result); $this->assertArrayHasKey('#NULL!', $result);
} }
} }

View File

@ -13,7 +13,7 @@ class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
protected function createCellStub() protected function createCellStub()
{ {
@ -32,12 +32,12 @@ class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
* @dataProvider binderProvider * @dataProvider binderProvider
*/ */
public function testBindValue($value) public function testBindValue($value)
{ {
$this->createCellStub(); $this->createCellStub();
$binder = new PHPExcel_Cell_DefaultValueBinder(); $binder = new PHPExcel_Cell_DefaultValueBinder();
$result = $binder->bindValue($this->cellStub, $value); $result = $binder->bindValue($this->cellStub, $value);
$this->assertTrue($result); $this->assertTrue($result);
} }
public function binderProvider() public function binderProvider()
{ {
@ -60,26 +60,26 @@ class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
/** /**
* @dataProvider providerDataTypeForValue * @dataProvider providerDataTypeForValue
*/ */
public function testDataTypeForValue() public function testDataTypeForValue()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $args); $result = call_user_func_array(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerDataTypeForValue() 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 = new PHPExcel_RichText();
$objRichText->createText('Hello World'); $objRichText->createText('Hello World');
$expectedResult = PHPExcel_Cell_DataType::TYPE_INLINE; $expectedResult = PHPExcel_Cell_DataType::TYPE_INLINE;
$result = call_user_func(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $objRichText); $result = call_user_func(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $objRichText);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
} }

View File

@ -11,78 +11,78 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testGetUrl() public function testGetUrl()
{ {
$urlValue = 'http://www.phpexcel.net'; $urlValue = 'http://www.phpexcel.net';
$testInstance = new PHPExcel_Cell_Hyperlink($urlValue); $testInstance = new PHPExcel_Cell_Hyperlink($urlValue);
$result = $testInstance->getUrl(); $result = $testInstance->getUrl();
$this->assertEquals($urlValue,$result); $this->assertEquals($urlValue,$result);
} }
public function testSetUrl() public function testSetUrl()
{ {
$initialUrlValue = 'http://www.phpexcel.net'; $initialUrlValue = 'http://www.phpexcel.net';
$newUrlValue = 'http://github.com/PHPOffice/PHPExcel'; $newUrlValue = 'http://github.com/PHPOffice/PHPExcel';
$testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue); $testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue);
$result = $testInstance->setUrl($newUrlValue); $result = $testInstance->setUrl($newUrlValue);
$this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink); $this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
$result = $testInstance->getUrl(); $result = $testInstance->getUrl();
$this->assertEquals($newUrlValue,$result); $this->assertEquals($newUrlValue,$result);
} }
public function testGetTooltip() public function testGetTooltip()
{ {
$tooltipValue = 'PHPExcel Web Site'; $tooltipValue = 'PHPExcel Web Site';
$testInstance = new PHPExcel_Cell_Hyperlink(NULL, $tooltipValue); $testInstance = new PHPExcel_Cell_Hyperlink(null, $tooltipValue);
$result = $testInstance->getTooltip(); $result = $testInstance->getTooltip();
$this->assertEquals($tooltipValue,$result); $this->assertEquals($tooltipValue,$result);
} }
public function testSetTooltip() public function testSetTooltip()
{ {
$initialTooltipValue = 'PHPExcel Web Site'; $initialTooltipValue = 'PHPExcel Web Site';
$newTooltipValue = 'PHPExcel Repository on Github'; $newTooltipValue = 'PHPExcel Repository on Github';
$testInstance = new PHPExcel_Cell_Hyperlink(NULL, $initialTooltipValue); $testInstance = new PHPExcel_Cell_Hyperlink(null, $initialTooltipValue);
$result = $testInstance->setTooltip($newTooltipValue); $result = $testInstance->setTooltip($newTooltipValue);
$this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink); $this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
$result = $testInstance->getTooltip(); $result = $testInstance->getTooltip();
$this->assertEquals($newTooltipValue,$result); $this->assertEquals($newTooltipValue,$result);
} }
public function testIsInternal() public function testIsInternal()
{ {
$initialUrlValue = 'http://www.phpexcel.net'; $initialUrlValue = 'http://www.phpexcel.net';
$newUrlValue = 'sheet://Worksheet1!A1'; $newUrlValue = 'sheet://Worksheet1!A1';
$testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue); $testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue);
$result = $testInstance->isInternal(); $result = $testInstance->isInternal();
$this->assertFalse($result); $this->assertFalse($result);
$testInstance->setUrl($newUrlValue); $testInstance->setUrl($newUrlValue);
$result = $testInstance->isInternal(); $result = $testInstance->isInternal();
$this->assertTrue($result); $this->assertTrue($result);
} }
public function testGetHashCode() public function testGetHashCode()
{ {
$urlValue = 'http://www.phpexcel.net'; $urlValue = 'http://www.phpexcel.net';
$tooltipValue = 'PHPExcel Web Site'; $tooltipValue = 'PHPExcel Web Site';
$initialExpectedHash = 'd84d713aed1dbbc8a7c5af183d6c7dbb'; $initialExpectedHash = 'd84d713aed1dbbc8a7c5af183d6c7dbb';
$testInstance = new PHPExcel_Cell_Hyperlink($urlValue, $tooltipValue); $testInstance = new PHPExcel_Cell_Hyperlink($urlValue, $tooltipValue);
$result = $testInstance->getHashCode(); $result = $testInstance->getHashCode();
$this->assertEquals($initialExpectedHash,$result); $this->assertEquals($initialExpectedHash,$result);
} }
} }

View File

@ -12,284 +12,284 @@ class CellTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
/** /**
* @dataProvider providerColumnString * @dataProvider providerColumnString
*/ */
public function testColumnIndexFromString() public function testColumnIndexFromString()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','columnIndexFromString'),$args); $result = call_user_func_array(array('PHPExcel_Cell','columnIndexFromString'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerColumnString() public function providerColumnString()
{ {
return new testDataFileIterator('rawTestData/ColumnString.data'); return new testDataFileIterator('rawTestData/ColumnString.data');
} }
public function testColumnIndexFromStringTooLong() public function testColumnIndexFromStringTooLong()
{ {
$cellAddress = 'ABCD'; $cellAddress = 'ABCD';
try { try {
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters'); $this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
public function testColumnIndexFromStringTooShort() public function testColumnIndexFromStringTooShort()
{ {
$cellAddress = ''; $cellAddress = '';
try { try {
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Column string index can not be empty'); $this->assertEquals($e->getMessage(), 'Column string index can not be empty');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
/** /**
* @dataProvider providerColumnIndex * @dataProvider providerColumnIndex
*/ */
public function testStringFromColumnIndex() public function testStringFromColumnIndex()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','stringFromColumnIndex'),$args); $result = call_user_func_array(array('PHPExcel_Cell','stringFromColumnIndex'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerColumnIndex() public function providerColumnIndex()
{ {
return new testDataFileIterator('rawTestData/ColumnIndex.data'); return new testDataFileIterator('rawTestData/ColumnIndex.data');
} }
/** /**
* @dataProvider providerCoordinates * @dataProvider providerCoordinates
*/ */
public function testCoordinateFromString() public function testCoordinateFromString()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','coordinateFromString'),$args); $result = call_user_func_array(array('PHPExcel_Cell','coordinateFromString'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCoordinates() public function providerCoordinates()
{ {
return new testDataFileIterator('rawTestData/CellCoordinates.data'); return new testDataFileIterator('rawTestData/CellCoordinates.data');
} }
public function testCoordinateFromStringWithRangeAddress() public function testCoordinateFromStringWithRangeAddress()
{ {
$cellAddress = 'A1:AI2012'; $cellAddress = 'A1:AI2012';
try { try {
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells'); $this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
public function testCoordinateFromStringWithEmptyAddress() public function testCoordinateFromStringWithEmptyAddress()
{ {
$cellAddress = ''; $cellAddress = '';
try { try {
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string'); $this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
public function testCoordinateFromStringWithInvalidAddress() public function testCoordinateFromStringWithInvalidAddress()
{ {
$cellAddress = 'AI'; $cellAddress = 'AI';
try { try {
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Invalid cell coordinate '.$cellAddress); $this->assertEquals($e->getMessage(), 'Invalid cell coordinate '.$cellAddress);
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
/** /**
* @dataProvider providerAbsoluteCoordinates * @dataProvider providerAbsoluteCoordinates
*/ */
public function testAbsoluteCoordinateFromString() public function testAbsoluteCoordinateFromString()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','absoluteCoordinate'),$args); $result = call_user_func_array(array('PHPExcel_Cell','absoluteCoordinate'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerAbsoluteCoordinates() public function providerAbsoluteCoordinates()
{ {
return new testDataFileIterator('rawTestData/CellAbsoluteCoordinate.data'); return new testDataFileIterator('rawTestData/CellAbsoluteCoordinate.data');
} }
public function testAbsoluteCoordinateFromStringWithRangeAddress() public function testAbsoluteCoordinateFromStringWithRangeAddress()
{ {
$cellAddress = 'A1:AI2012'; $cellAddress = 'A1:AI2012';
try { try {
$result = call_user_func(array('PHPExcel_Cell','absoluteCoordinate'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','absoluteCoordinate'),$cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells'); $this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
/** /**
* @dataProvider providerAbsoluteReferences * @dataProvider providerAbsoluteReferences
*/ */
public function testAbsoluteReferenceFromString() public function testAbsoluteReferenceFromString()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','absoluteReference'),$args); $result = call_user_func_array(array('PHPExcel_Cell','absoluteReference'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerAbsoluteReferences() public function providerAbsoluteReferences()
{ {
return new testDataFileIterator('rawTestData/CellAbsoluteReference.data'); return new testDataFileIterator('rawTestData/CellAbsoluteReference.data');
} }
public function testAbsoluteReferenceFromStringWithRangeAddress() public function testAbsoluteReferenceFromStringWithRangeAddress()
{ {
$cellAddress = 'A1:AI2012'; $cellAddress = 'A1:AI2012';
try { try {
$result = call_user_func(array('PHPExcel_Cell','absoluteReference'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','absoluteReference'),$cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells'); $this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
/** /**
* @dataProvider providerSplitRange * @dataProvider providerSplitRange
*/ */
public function testSplitRange() public function testSplitRange()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','splitRange'),$args); $result = call_user_func_array(array('PHPExcel_Cell','splitRange'),$args);
foreach($result as $key => $split) { foreach ($result as $key => $split) {
if (!is_array($expectedResult[$key])) { if (!is_array($expectedResult[$key])) {
$this->assertEquals($expectedResult[$key], $split[0]); $this->assertEquals($expectedResult[$key], $split[0]);
} else { } else {
$this->assertEquals($expectedResult[$key], $split); $this->assertEquals($expectedResult[$key], $split);
} }
} }
} }
public function providerSplitRange() public function providerSplitRange()
{ {
return new testDataFileIterator('rawTestData/CellSplitRange.data'); return new testDataFileIterator('rawTestData/CellSplitRange.data');
} }
/** /**
* @dataProvider providerBuildRange * @dataProvider providerBuildRange
*/ */
public function testBuildRange() public function testBuildRange()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','buildRange'),$args); $result = call_user_func_array(array('PHPExcel_Cell','buildRange'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerBuildRange() public function providerBuildRange()
{ {
return new testDataFileIterator('rawTestData/CellBuildRange.data'); return new testDataFileIterator('rawTestData/CellBuildRange.data');
} }
public function testBuildRangeInvalid() public function testBuildRangeInvalid()
{ {
$cellRange = ''; $cellRange = '';
try { try {
$result = call_user_func(array('PHPExcel_Cell','buildRange'),$cellRange); $result = call_user_func(array('PHPExcel_Cell','buildRange'),$cellRange);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Range does not contain any information'); $this->assertEquals($e->getMessage(), 'Range does not contain any information');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
/** /**
* @dataProvider providerRangeBoundaries * @dataProvider providerRangeBoundaries
*/ */
public function testRangeBoundaries() public function testRangeBoundaries()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','rangeBoundaries'),$args); $result = call_user_func_array(array('PHPExcel_Cell','rangeBoundaries'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerRangeBoundaries() public function providerRangeBoundaries()
{ {
return new testDataFileIterator('rawTestData/CellRangeBoundaries.data'); return new testDataFileIterator('rawTestData/CellRangeBoundaries.data');
} }
/** /**
* @dataProvider providerRangeDimension * @dataProvider providerRangeDimension
*/ */
public function testRangeDimension() public function testRangeDimension()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','rangeDimension'),$args); $result = call_user_func_array(array('PHPExcel_Cell','rangeDimension'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerRangeDimension() public function providerRangeDimension()
{ {
return new testDataFileIterator('rawTestData/CellRangeDimension.data'); return new testDataFileIterator('rawTestData/CellRangeDimension.data');
} }
/** /**
* @dataProvider providerGetRangeBoundaries * @dataProvider providerGetRangeBoundaries
*/ */
public function testGetRangeBoundaries() public function testGetRangeBoundaries()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','getRangeBoundaries'),$args); $result = call_user_func_array(array('PHPExcel_Cell','getRangeBoundaries'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerGetRangeBoundaries() public function providerGetRangeBoundaries()
{ {
return new testDataFileIterator('rawTestData/CellGetRangeBoundaries.data'); return new testDataFileIterator('rawTestData/CellGetRangeBoundaries.data');
} }
/** /**
* @dataProvider providerExtractAllCellReferencesInRange * @dataProvider providerExtractAllCellReferencesInRange
*/ */
public function testExtractAllCellReferencesInRange() public function testExtractAllCellReferencesInRange()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','extractAllCellReferencesInRange'),$args); $result = call_user_func_array(array('PHPExcel_Cell','extractAllCellReferencesInRange'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerExtractAllCellReferencesInRange() public function providerExtractAllCellReferencesInRange()
{ {
return new testDataFileIterator('rawTestData/CellExtractAllCellReferencesInRange.data'); return new testDataFileIterator('rawTestData/CellExtractAllCellReferencesInRange.data');
} }
} }

View File

@ -11,45 +11,45 @@ class DataSeriesValuesTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testSetDataType() public function testSetDataType()
{ {
$dataTypeValues = array( $dataTypeValues = array(
'Number', 'Number',
'String' 'String'
); );
$testInstance = new PHPExcel_Chart_DataSeriesValues; $testInstance = new PHPExcel_Chart_DataSeriesValues;
foreach($dataTypeValues as $dataTypeValue) { foreach ($dataTypeValues as $dataTypeValue) {
$result = $testInstance->setDataType($dataTypeValue); $result = $testInstance->setDataType($dataTypeValue);
$this->assertTrue($result instanceof PHPExcel_Chart_DataSeriesValues); $this->assertTrue($result instanceof PHPExcel_Chart_DataSeriesValues);
} }
} }
public function testSetInvalidDataTypeThrowsException() public function testSetInvalidDataTypeThrowsException()
{ {
$testInstance = new PHPExcel_Chart_DataSeriesValues; $testInstance = new PHPExcel_Chart_DataSeriesValues;
try { try {
$result = $testInstance->setDataType('BOOLEAN'); $result = $testInstance->setDataType('BOOLEAN');
} catch (Exception $e) { } catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Invalid datatype for chart data series values'); $this->assertEquals($e->getMessage(), 'Invalid datatype for chart data series values');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
public function testGetDataType() public function testGetDataType()
{ {
$dataTypeValue = 'String'; $dataTypeValue = 'String';
$testInstance = new PHPExcel_Chart_DataSeriesValues; $testInstance = new PHPExcel_Chart_DataSeriesValues;
$setValue = $testInstance->setDataType($dataTypeValue); $setValue = $testInstance->setDataType($dataTypeValue);
$result = $testInstance->getDataType(); $result = $testInstance->getDataType();
$this->assertEquals($dataTypeValue,$result); $this->assertEquals($dataTypeValue,$result);
} }
} }

View File

@ -11,27 +11,27 @@ class LayoutTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testSetLayoutTarget() public function testSetLayoutTarget()
{ {
$LayoutTargetValue = 'String'; $LayoutTargetValue = 'String';
$testInstance = new PHPExcel_Chart_Layout; $testInstance = new PHPExcel_Chart_Layout;
$result = $testInstance->setLayoutTarget($LayoutTargetValue); $result = $testInstance->setLayoutTarget($LayoutTargetValue);
$this->assertTrue($result instanceof PHPExcel_Chart_Layout); $this->assertTrue($result instanceof PHPExcel_Chart_Layout);
} }
public function testGetLayoutTarget() public function testGetLayoutTarget()
{ {
$LayoutTargetValue = 'String'; $LayoutTargetValue = 'String';
$testInstance = new PHPExcel_Chart_Layout; $testInstance = new PHPExcel_Chart_Layout;
$setValue = $testInstance->setLayoutTarget($LayoutTargetValue); $setValue = $testInstance->setLayoutTarget($LayoutTargetValue);
$result = $testInstance->getLayoutTarget(); $result = $testInstance->getLayoutTarget();
$this->assertEquals($LayoutTargetValue,$result); $this->assertEquals($LayoutTargetValue,$result);
} }
} }

View File

@ -11,124 +11,124 @@ class LegendTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testSetPosition() public function testSetPosition()
{ {
$positionValues = array( $positionValues = array(
PHPExcel_Chart_Legend::POSITION_RIGHT, PHPExcel_Chart_Legend::POSITION_RIGHT,
PHPExcel_Chart_Legend::POSITION_LEFT, PHPExcel_Chart_Legend::POSITION_LEFT,
PHPExcel_Chart_Legend::POSITION_TOP, PHPExcel_Chart_Legend::POSITION_TOP,
PHPExcel_Chart_Legend::POSITION_BOTTOM, PHPExcel_Chart_Legend::POSITION_BOTTOM,
PHPExcel_Chart_Legend::POSITION_TOPRIGHT, PHPExcel_Chart_Legend::POSITION_TOPRIGHT,
); );
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
foreach($positionValues as $positionValue) { foreach ($positionValues as $positionValue) {
$result = $testInstance->setPosition($positionValue); $result = $testInstance->setPosition($positionValue);
$this->assertTrue($result); $this->assertTrue($result);
} }
} }
public function testSetInvalidPositionReturnsFalse() public function testSetInvalidPositionReturnsFalse()
{ {
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$result = $testInstance->setPosition('BottomLeft'); $result = $testInstance->setPosition('BottomLeft');
$this->assertFalse($result); $this->assertFalse($result);
// Ensure that value is unchanged // Ensure that value is unchanged
$result = $testInstance->getPosition(); $result = $testInstance->getPosition();
$this->assertEquals(PHPExcel_Chart_Legend::POSITION_RIGHT,$result); $this->assertEquals(PHPExcel_Chart_Legend::POSITION_RIGHT,$result);
} }
public function testGetPosition() public function testGetPosition()
{ {
$PositionValue = PHPExcel_Chart_Legend::POSITION_BOTTOM; $PositionValue = PHPExcel_Chart_Legend::POSITION_BOTTOM;
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$setValue = $testInstance->setPosition($PositionValue); $setValue = $testInstance->setPosition($PositionValue);
$result = $testInstance->getPosition(); $result = $testInstance->getPosition();
$this->assertEquals($PositionValue,$result); $this->assertEquals($PositionValue,$result);
} }
public function testSetPositionXL() public function testSetPositionXL()
{ {
$positionValues = array( $positionValues = array(
PHPExcel_Chart_Legend::xlLegendPositionBottom, PHPExcel_Chart_Legend::xlLegendPositionBottom,
PHPExcel_Chart_Legend::xlLegendPositionCorner, PHPExcel_Chart_Legend::xlLegendPositionCorner,
PHPExcel_Chart_Legend::xlLegendPositionCustom, PHPExcel_Chart_Legend::xlLegendPositionCustom,
PHPExcel_Chart_Legend::xlLegendPositionLeft, PHPExcel_Chart_Legend::xlLegendPositionLeft,
PHPExcel_Chart_Legend::xlLegendPositionRight, PHPExcel_Chart_Legend::xlLegendPositionRight,
PHPExcel_Chart_Legend::xlLegendPositionTop, PHPExcel_Chart_Legend::xlLegendPositionTop,
); );
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
foreach($positionValues as $positionValue) { foreach ($positionValues as $positionValue) {
$result = $testInstance->setPositionXL($positionValue); $result = $testInstance->setPositionXL($positionValue);
$this->assertTrue($result); $this->assertTrue($result);
} }
} }
public function testSetInvalidXLPositionReturnsFalse() public function testSetInvalidXLPositionReturnsFalse()
{ {
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$result = $testInstance->setPositionXL(999); $result = $testInstance->setPositionXL(999);
$this->assertFalse($result); $this->assertFalse($result);
// Ensure that value is unchanged // Ensure that value is unchanged
$result = $testInstance->getPositionXL(); $result = $testInstance->getPositionXL();
$this->assertEquals(PHPExcel_Chart_Legend::xlLegendPositionRight,$result); $this->assertEquals(PHPExcel_Chart_Legend::xlLegendPositionRight,$result);
} }
public function testGetPositionXL() public function testGetPositionXL()
{ {
$PositionValue = PHPExcel_Chart_Legend::xlLegendPositionCorner; $PositionValue = PHPExcel_Chart_Legend::xlLegendPositionCorner;
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$setValue = $testInstance->setPositionXL($PositionValue); $setValue = $testInstance->setPositionXL($PositionValue);
$result = $testInstance->getPositionXL(); $result = $testInstance->getPositionXL();
$this->assertEquals($PositionValue,$result); $this->assertEquals($PositionValue,$result);
} }
public function testSetOverlay() public function testSetOverlay()
{ {
$overlayValues = array( $overlayValues = array(
TRUE, true,
FALSE, false,
); );
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
foreach($overlayValues as $overlayValue) { foreach ($overlayValues as $overlayValue) {
$result = $testInstance->setOverlay($overlayValue); $result = $testInstance->setOverlay($overlayValue);
$this->assertTrue($result); $this->assertTrue($result);
} }
} }
public function testSetInvalidOverlayReturnsFalse() public function testSetInvalidOverlayReturnsFalse()
{ {
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$result = $testInstance->setOverlay('INVALID'); $result = $testInstance->setOverlay('INVALID');
$this->assertFalse($result); $this->assertFalse($result);
$result = $testInstance->getOverlay(); $result = $testInstance->getOverlay();
$this->assertFalse($result); $this->assertFalse($result);
} }
public function testGetOverlay() public function testGetOverlay()
{ {
$OverlayValue = TRUE; $OverlayValue = true;
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$setValue = $testInstance->setOverlay($OverlayValue); $setValue = $testInstance->setOverlay($OverlayValue);
$result = $testInstance->getOverlay(); $result = $testInstance->getOverlay();
$this->assertEquals($OverlayValue,$result); $this->assertEquals($OverlayValue,$result);
} }
} }

View File

@ -10,46 +10,46 @@ class XEEValidatorTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
/** /**
* @dataProvider providerInvalidXML * @dataProvider providerInvalidXML
* @expectedException PHPExcel_Reader_Exception * @expectedException PHPExcel_Reader_Exception
*/ */
public function testInvalidXML($filename) public function testInvalidXML($filename)
{ {
$reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract'); $reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract');
$expectedResult = 'FAILURE: Should throw an Exception rather than return a value'; $expectedResult = 'FAILURE: Should throw an Exception rather than return a value';
$result = $reader->securityScanFile($filename); $result = $reader->securityScanFile($filename);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerInvalidXML() public function providerInvalidXML()
{ {
$tests = []; $tests = [];
foreach(glob('rawTestData/Reader/XEETestInvalid*.xml') as $file) { foreach (glob('rawTestData/Reader/XEETestInvalid*.xml') as $file) {
$tests[] = [realpath($file), true]; $tests[] = [realpath($file), true];
} }
return $tests; return $tests;
} }
/** /**
* @dataProvider providerValidXML * @dataProvider providerValidXML
*/ */
public function testValidXML($filename, $expectedResult) public function testValidXML($filename, $expectedResult)
{ {
$reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract'); $reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract');
$result = $reader->securityScanFile($filename); $result = $reader->securityScanFile($filename);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerValidXML() public function providerValidXML()
{ {
$tests = []; $tests = [];
foreach(glob('rawTestData/Reader/XEETestValid*.xml') as $file) { foreach (glob('rawTestData/Reader/XEETestValid*.xml') as $file) {
$tests[] = [realpath($file), file_get_contents($file)]; $tests[] = [realpath($file), file_get_contents($file)];
} }
return $tests; return $tests;
} }
} }

View File

@ -10,49 +10,49 @@ class ReferenceHelperTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testColumnSort() public function testColumnSort()
{ {
$columnBase = $columnExpectedResult = array( $columnBase = $columnExpectedResult = array(
'A','B','Z', 'A','B','Z',
'AA','AB','AZ', 'AA','AB','AZ',
'BA','BB','BZ', 'BA','BB','BZ',
'ZA','ZB','ZZ', 'ZA','ZB','ZZ',
'AAA','AAB','AAZ', 'AAA','AAB','AAZ',
'ABA','ABB','ABZ', 'ABA','ABB','ABZ',
'AZA','AZB','AZZ', 'AZA','AZB','AZZ',
'BAA','BAB','BAZ', 'BAA','BAB','BAZ',
'BBA','BBB','BBZ', 'BBA','BBB','BBZ',
'BZA','BZB','BZZ' 'BZA','BZB','BZZ'
); );
shuffle($columnBase); shuffle($columnBase);
usort($columnBase, array('PHPExcel_ReferenceHelper','columnSort')); usort($columnBase, array('PHPExcel_ReferenceHelper','columnSort'));
foreach($columnBase as $key => $value) { foreach ($columnBase as $key => $value) {
$this->assertEquals($columnExpectedResult[$key], $value); $this->assertEquals($columnExpectedResult[$key], $value);
} }
} }
public function testColumnReverseSort() public function testColumnReverseSort()
{ {
$columnBase = $columnExpectedResult = array( $columnBase = $columnExpectedResult = array(
'A','B','Z', 'A','B','Z',
'AA','AB','AZ', 'AA','AB','AZ',
'BA','BB','BZ', 'BA','BB','BZ',
'ZA','ZB','ZZ', 'ZA','ZB','ZZ',
'AAA','AAB','AAZ', 'AAA','AAB','AAZ',
'ABA','ABB','ABZ', 'ABA','ABB','ABZ',
'AZA','AZB','AZZ', 'AZA','AZB','AZZ',
'BAA','BAB','BAZ', 'BAA','BAB','BAZ',
'BBA','BBB','BBZ', 'BBA','BBB','BBZ',
'BZA','BZB','BZZ' 'BZA','BZB','BZZ'
); );
shuffle($columnBase); shuffle($columnBase);
$columnExpectedResult = array_reverse($columnExpectedResult); $columnExpectedResult = array_reverse($columnExpectedResult);
usort($columnBase, array('PHPExcel_ReferenceHelper','columnReverseSort')); usort($columnBase, array('PHPExcel_ReferenceHelper','columnReverseSort'));
foreach($columnBase as $key => $value) { foreach ($columnBase as $key => $value) {
$this->assertEquals($columnExpectedResult[$key], $value); $this->assertEquals($columnExpectedResult[$key], $value);
} }
} }
} }

View File

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

View File

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

View File

@ -12,28 +12,28 @@ class FileTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testGetUseUploadTempDirectory() public function testGetUseUploadTempDirectory()
{ {
$expectedResult = FALSE; $expectedResult = FALSE;
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory')); $result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testSetUseUploadTempDirectory() public function testSetUseUploadTempDirectory()
{ {
$useUploadTempDirectoryValues = array( $useUploadTempDirectoryValues = array(
TRUE, true,
FALSE, false,
); );
foreach($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) { foreach ($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {
call_user_func(array('PHPExcel_Shared_File','setUseUploadTempDirectory'),$useUploadTempDirectoryValue); call_user_func(array('PHPExcel_Shared_File','setUseUploadTempDirectory'),$useUploadTempDirectoryValue);
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory')); $result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
$this->assertEquals($useUploadTempDirectoryValue, $result); $this->assertEquals($useUploadTempDirectoryValue, $result);
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -12,70 +12,70 @@ class ColorTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
/** /**
* @dataProvider providerColorGetRed * @dataProvider providerColorGetRed
*/ */
public function testGetRed() public function testGetRed()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Style_Color','getRed'),$args); $result = call_user_func_array(array('PHPExcel_Style_Color','getRed'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerColorGetRed() public function providerColorGetRed()
{ {
return new testDataFileIterator('rawTestData/Style/ColorGetRed.data'); return new testDataFileIterator('rawTestData/Style/ColorGetRed.data');
} }
/** /**
* @dataProvider providerColorGetGreen * @dataProvider providerColorGetGreen
*/ */
public function testGetGreen() public function testGetGreen()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Style_Color','getGreen'),$args); $result = call_user_func_array(array('PHPExcel_Style_Color','getGreen'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerColorGetGreen() public function providerColorGetGreen()
{ {
return new testDataFileIterator('rawTestData/Style/ColorGetGreen.data'); return new testDataFileIterator('rawTestData/Style/ColorGetGreen.data');
} }
/** /**
* @dataProvider providerColorGetBlue * @dataProvider providerColorGetBlue
*/ */
public function testGetBlue() public function testGetBlue()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Style_Color','getBlue'),$args); $result = call_user_func_array(array('PHPExcel_Style_Color','getBlue'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerColorGetBlue() public function providerColorGetBlue()
{ {
return new testDataFileIterator('rawTestData/Style/ColorGetBlue.data'); return new testDataFileIterator('rawTestData/Style/ColorGetBlue.data');
} }
/** /**
* @dataProvider providerColorChangeBrightness * @dataProvider providerColorChangeBrightness
*/ */
public function testChangeBrightness() public function testChangeBrightness()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Style_Color','changeBrightness'),$args); $result = call_user_func_array(array('PHPExcel_Style_Color','changeBrightness'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerColorChangeBrightness() public function providerColorChangeBrightness()
{ {
return new testDataFileIterator('rawTestData/Style/ColorChangeBrightness.data'); return new testDataFileIterator('rawTestData/Style/ColorChangeBrightness.data');
} }
} }

View File

@ -13,24 +13,24 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Shared_String::setDecimalSeparator('.'); PHPExcel_Shared_String::setDecimalSeparator('.');
PHPExcel_Shared_String::setThousandsSeparator(','); PHPExcel_Shared_String::setThousandsSeparator(',');
} }
/** /**
* @dataProvider providerNumberFormat * @dataProvider providerNumberFormat
*/ */
public function testFormatValueWithMask() public function testFormatValueWithMask()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Style_NumberFormat','toFormattedString'),$args); $result = call_user_func_array(array('PHPExcel_Style_NumberFormat','toFormattedString'),$args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerNumberFormat() public function providerNumberFormat()
{ {
return new testDataFileIterator('rawTestData/Style/NumberFormat.data'); return new testDataFileIterator('rawTestData/Style/NumberFormat.data');
} }
} }

View File

@ -3,9 +3,9 @@
class RuleTest extends PHPUnit_Framework_TestCase class RuleTest extends PHPUnit_Framework_TestCase
{ {
private $_testAutoFilterRuleObject; private $_testAutoFilterRuleObject;
private $_mockAutoFilterColumnObject; private $_mockAutoFilterColumnObject;
public function setUp() public function setUp()
{ {
@ -15,95 +15,95 @@ class RuleTest extends PHPUnit_Framework_TestCase
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->_mockAutoFilterColumnObject = $this->getMockBuilder('PHPExcel_Worksheet_AutoFilter_Column') $this->_mockAutoFilterColumnObject = $this->getMockBuilder('PHPExcel_Worksheet_AutoFilter_Column')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->_mockAutoFilterColumnObject->expects($this->any()) $this->_mockAutoFilterColumnObject->expects($this->any())
->method('testColumnInRange') ->method('testColumnInRange')
->will($this->returnValue(3)); ->will($this->returnValue(3));
$this->_testAutoFilterRuleObject = new PHPExcel_Worksheet_AutoFilter_Column_Rule( $this->_testAutoFilterRuleObject = new PHPExcel_Worksheet_AutoFilter_Column_Rule(
$this->_mockAutoFilterColumnObject $this->_mockAutoFilterColumnObject
); );
} }
public function testGetRuleType() public function testGetRuleType()
{ {
$result = $this->_testAutoFilterRuleObject->getRuleType(); $result = $this->_testAutoFilterRuleObject->getRuleType();
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER, $result); $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER, $result);
} }
public function testSetRuleType() public function testSetRuleType()
{ {
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP; $expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP;
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterRuleObject->setRuleType($expectedResult); $result = $this->_testAutoFilterRuleObject->setRuleType($expectedResult);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
$result = $this->_testAutoFilterRuleObject->getRuleType(); $result = $this->_testAutoFilterRuleObject->getRuleType();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testSetValue() public function testSetValue()
{ {
$expectedResult = 100; $expectedResult = 100;
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterRuleObject->setValue($expectedResult); $result = $this->_testAutoFilterRuleObject->setValue($expectedResult);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
$result = $this->_testAutoFilterRuleObject->getValue(); $result = $this->_testAutoFilterRuleObject->getValue();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testGetOperator() public function testGetOperator()
{ {
$result = $this->_testAutoFilterRuleObject->getOperator(); $result = $this->_testAutoFilterRuleObject->getOperator();
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result); $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result);
} }
public function testSetOperator() public function testSetOperator()
{ {
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; $expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterRuleObject->setOperator($expectedResult); $result = $this->_testAutoFilterRuleObject->setOperator($expectedResult);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
$result = $this->_testAutoFilterRuleObject->getOperator(); $result = $this->_testAutoFilterRuleObject->getOperator();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testSetGrouping() public function testSetGrouping()
{ {
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH; $expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH;
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterRuleObject->setGrouping($expectedResult); $result = $this->_testAutoFilterRuleObject->setGrouping($expectedResult);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
$result = $this->_testAutoFilterRuleObject->getGrouping(); $result = $this->_testAutoFilterRuleObject->getGrouping();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testGetParent() public function testGetParent()
{ {
$result = $this->_testAutoFilterRuleObject->getParent(); $result = $this->_testAutoFilterRuleObject->getParent();
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
} }
public function testSetParent() public function testSetParent()
{ {
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterRuleObject->setParent($this->_mockAutoFilterColumnObject); $result = $this->_testAutoFilterRuleObject->setParent($this->_mockAutoFilterColumnObject);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
} }
public function testClone() public function testClone()
{ {
$result = clone $this->_testAutoFilterRuleObject; $result = clone $this->_testAutoFilterRuleObject;
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
} }
} }

View File

@ -3,11 +3,11 @@
class AutofilterColumnTest extends PHPUnit_Framework_TestCase class AutofilterColumnTest extends PHPUnit_Framework_TestCase
{ {
private $_testInitialColumn = 'H'; private $_testInitialColumn = 'H';
private $_testAutoFilterColumnObject; private $_testAutoFilterColumnObject;
private $_mockAutoFilterObject; private $_mockAutoFilterObject;
public function setUp() public function setUp()
{ {
@ -17,157 +17,157 @@ class AutofilterColumnTest extends PHPUnit_Framework_TestCase
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->_mockAutoFilterObject = $this->getMockBuilder('PHPExcel_Worksheet_AutoFilter') $this->_mockAutoFilterObject = $this->getMockBuilder('PHPExcel_Worksheet_AutoFilter')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->_mockAutoFilterObject->expects($this->any()) $this->_mockAutoFilterObject->expects($this->any())
->method('testColumnInRange') ->method('testColumnInRange')
->will($this->returnValue(3)); ->will($this->returnValue(3));
$this->_testAutoFilterColumnObject = new PHPExcel_Worksheet_AutoFilter_Column( $this->_testAutoFilterColumnObject = new PHPExcel_Worksheet_AutoFilter_Column(
$this->_testInitialColumn, $this->_testInitialColumn,
$this->_mockAutoFilterObject $this->_mockAutoFilterObject
); );
} }
public function testGetColumnIndex() public function testGetColumnIndex()
{ {
$result = $this->_testAutoFilterColumnObject->getColumnIndex(); $result = $this->_testAutoFilterColumnObject->getColumnIndex();
$this->assertEquals($this->_testInitialColumn, $result); $this->assertEquals($this->_testInitialColumn, $result);
} }
public function testSetColumnIndex() public function testSetColumnIndex()
{ {
$expectedResult = 'L'; $expectedResult = 'L';
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterColumnObject->setColumnIndex($expectedResult); $result = $this->_testAutoFilterColumnObject->setColumnIndex($expectedResult);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
$result = $this->_testAutoFilterColumnObject->getColumnIndex(); $result = $this->_testAutoFilterColumnObject->getColumnIndex();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testGetParent() public function testGetParent()
{ {
$result = $this->_testAutoFilterColumnObject->getParent(); $result = $this->_testAutoFilterColumnObject->getParent();
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
} }
public function testSetParent() public function testSetParent()
{ {
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterColumnObject->setParent($this->_mockAutoFilterObject); $result = $this->_testAutoFilterColumnObject->setParent($this->_mockAutoFilterObject);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
} }
public function testGetFilterType() public function testGetFilterType()
{ {
$result = $this->_testAutoFilterColumnObject->getFilterType(); $result = $this->_testAutoFilterColumnObject->getFilterType();
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER, $result); $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER, $result);
} }
public function testSetFilterType() public function testSetFilterType()
{ {
$result = $this->_testAutoFilterColumnObject->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER); $result = $this->_testAutoFilterColumnObject->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
$result = $this->_testAutoFilterColumnObject->getFilterType(); $result = $this->_testAutoFilterColumnObject->getFilterType();
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result); $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception
*/ */
public function testSetInvalidFilterTypeThrowsException() public function testSetInvalidFilterTypeThrowsException()
{ {
$expectedResult = 'Unfiltered'; $expectedResult = 'Unfiltered';
$result = $this->_testAutoFilterColumnObject->setFilterType($expectedResult); $result = $this->_testAutoFilterColumnObject->setFilterType($expectedResult);
} }
public function testGetJoin() public function testGetJoin()
{ {
$result = $this->_testAutoFilterColumnObject->getJoin(); $result = $this->_testAutoFilterColumnObject->getJoin();
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR, $result); $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR, $result);
} }
public function testSetJoin() public function testSetJoin()
{ {
$result = $this->_testAutoFilterColumnObject->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND); $result = $this->_testAutoFilterColumnObject->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
$result = $this->_testAutoFilterColumnObject->getJoin(); $result = $this->_testAutoFilterColumnObject->getJoin();
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND, $result); $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND, $result);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception
*/ */
public function testSetInvalidJoinThrowsException() public function testSetInvalidJoinThrowsException()
{ {
$expectedResult = 'Neither'; $expectedResult = 'Neither';
$result = $this->_testAutoFilterColumnObject->setJoin($expectedResult); $result = $this->_testAutoFilterColumnObject->setJoin($expectedResult);
} }
public function testSetAttributes() public function testSetAttributes()
{ {
$attributeSet = array( 'val' => 100, $attributeSet = array( 'val' => 100,
'maxVal' => 200 'maxVal' => 200
); );
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterColumnObject->setAttributes($attributeSet); $result = $this->_testAutoFilterColumnObject->setAttributes($attributeSet);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
} }
public function testGetAttributes() public function testGetAttributes()
{ {
$attributeSet = array( 'val' => 100, $attributeSet = array( 'val' => 100,
'maxVal' => 200 'maxVal' => 200
); );
$this->_testAutoFilterColumnObject->setAttributes($attributeSet); $this->_testAutoFilterColumnObject->setAttributes($attributeSet);
$result = $this->_testAutoFilterColumnObject->getAttributes(); $result = $this->_testAutoFilterColumnObject->getAttributes();
$this->assertTrue(is_array($result)); $this->assertTrue(is_array($result));
$this->assertEquals(count($attributeSet), count($result)); $this->assertEquals(count($attributeSet), count($result));
} }
public function testSetAttribute() public function testSetAttribute()
{ {
$attributeSet = array( 'val' => 100, $attributeSet = array( 'val' => 100,
'maxVal' => 200 'maxVal' => 200
); );
foreach($attributeSet as $attributeName => $attributeValue) { foreach ($attributeSet as $attributeName => $attributeValue) {
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterColumnObject->setAttribute($attributeName,$attributeValue); $result = $this->_testAutoFilterColumnObject->setAttribute($attributeName,$attributeValue);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
} }
} }
public function testGetAttribute() public function testGetAttribute()
{ {
$attributeSet = array( 'val' => 100, $attributeSet = array( 'val' => 100,
'maxVal' => 200 'maxVal' => 200
); );
$this->_testAutoFilterColumnObject->setAttributes($attributeSet); $this->_testAutoFilterColumnObject->setAttributes($attributeSet);
foreach($attributeSet as $attributeName => $attributeValue) { foreach ($attributeSet as $attributeName => $attributeValue) {
$result = $this->_testAutoFilterColumnObject->getAttribute($attributeName); $result = $this->_testAutoFilterColumnObject->getAttribute($attributeName);
$this->assertEquals($attributeValue, $result); $this->assertEquals($attributeValue, $result);
} }
$result = $this->_testAutoFilterColumnObject->getAttribute('nonExistentAttribute'); $result = $this->_testAutoFilterColumnObject->getAttribute('nonExistentAttribute');
$this->assertNull($result); $this->assertNull($result);
} }
public function testClone() public function testClone()
{ {
$result = clone $this->_testAutoFilterColumnObject; $result = clone $this->_testAutoFilterColumnObject;
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
} }
} }

View File

@ -3,9 +3,9 @@
class AutoFilterTest extends PHPUnit_Framework_TestCase class AutoFilterTest extends PHPUnit_Framework_TestCase
{ {
private $_testInitialRange = 'H2:O256'; private $_testInitialRange = 'H2:O256';
private $_testAutoFilterObject; private $_testAutoFilterObject;
public function setUp() public function setUp()
@ -16,325 +16,325 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->_mockWorksheetObject = $this->getMockBuilder('PHPExcel_Worksheet') $this->_mockWorksheetObject = $this->getMockBuilder('PHPExcel_Worksheet')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->_mockCacheController = $this->getMockBuilder('PHPExcel_CachedObjectStorage_Memory') $this->_mockCacheController = $this->getMockBuilder('PHPExcel_CachedObjectStorage_Memory')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->_mockWorksheetObject->expects($this->any()) $this->_mockWorksheetObject->expects($this->any())
->method('getCellCacheController') ->method('getCellCacheController')
->will($this->returnValue($this->_mockCacheController)); ->will($this->returnValue($this->_mockCacheController));
$this->_testAutoFilterObject = new PHPExcel_Worksheet_AutoFilter( $this->_testAutoFilterObject = new PHPExcel_Worksheet_AutoFilter(
$this->_testInitialRange, $this->_testInitialRange,
$this->_mockWorksheetObject $this->_mockWorksheetObject
); );
} }
public function testToString() public function testToString()
{ {
$expectedResult = $this->_testInitialRange; $expectedResult = $this->_testInitialRange;
// magic __toString should return the active autofilter range // magic __toString should return the active autofilter range
$result = $this->_testAutoFilterObject; $result = $this->_testAutoFilterObject;
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testGetParent() public function testGetParent()
{ {
$result = $this->_testAutoFilterObject->getParent(); $result = $this->_testAutoFilterObject->getParent();
$this->assertInstanceOf('PHPExcel_Worksheet', $result); $this->assertInstanceOf('PHPExcel_Worksheet', $result);
} }
public function testSetParent() public function testSetParent()
{ {
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setParent($this->_mockWorksheetObject); $result = $this->_testAutoFilterObject->setParent($this->_mockWorksheetObject);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
} }
public function testGetRange() public function testGetRange()
{ {
$expectedResult = $this->_testInitialRange; $expectedResult = $this->_testInitialRange;
// Result should be the active autofilter range // Result should be the active autofilter range
$result = $this->_testAutoFilterObject->getRange(); $result = $this->_testAutoFilterObject->getRange();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testSetRange() public function testSetRange()
{ {
$ranges = array('G1:J512' => 'Worksheet1!G1:J512', $ranges = array('G1:J512' => 'Worksheet1!G1:J512',
'K1:N20' => 'K1:N20' 'K1:N20' => 'K1:N20'
); );
foreach($ranges as $actualRange => $fullRange) { foreach ($ranges as $actualRange => $fullRange) {
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setRange($fullRange); $result = $this->_testAutoFilterObject->setRange($fullRange);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
// Result should be the new autofilter range // Result should be the new autofilter range
$result = $this->_testAutoFilterObject->getRange(); $result = $this->_testAutoFilterObject->getRange();
$this->assertEquals($actualRange, $result); $this->assertEquals($actualRange, $result);
} }
} }
public function testClearRange() public function testClearRange()
{ {
$expectedResult = ''; $expectedResult = '';
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setRange(); $result = $this->_testAutoFilterObject->setRange();
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
// Result should be a clear range // Result should be a clear range
$result = $this->_testAutoFilterObject->getRange(); $result = $this->_testAutoFilterObject->getRange();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception
*/ */
public function testSetRangeInvalidRange() public function testSetRangeInvalidRange()
{ {
$expectedResult = 'A1'; $expectedResult = 'A1';
$result = $this->_testAutoFilterObject->setRange($expectedResult); $result = $this->_testAutoFilterObject->setRange($expectedResult);
} }
public function testGetColumnsEmpty() public function testGetColumnsEmpty()
{ {
// There should be no columns yet defined // There should be no columns yet defined
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->_testAutoFilterObject->getColumns();
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(0, count($result)); $this->assertEquals(0, count($result));
} }
public function testGetColumnOffset() public function testGetColumnOffset()
{ {
$columnIndexes = array( 'H' => 0, $columnIndexes = array( 'H' => 0,
'K' => 3, 'K' => 3,
'M' => 5 'M' => 5
); );
// If we request a specific column by its column ID, we should get an // If we request a specific column by its column ID, we should get an
// integer returned representing the column offset within the range // integer returned representing the column offset within the range
foreach($columnIndexes as $columnIndex => $columnOffset) { foreach ($columnIndexes as $columnIndex => $columnOffset) {
$result = $this->_testAutoFilterObject->getColumnOffset($columnIndex); $result = $this->_testAutoFilterObject->getColumnOffset($columnIndex);
$this->assertEquals($columnOffset, $result); $this->assertEquals($columnOffset, $result);
} }
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception
*/ */
public function testGetInvalidColumnOffset() public function testGetInvalidColumnOffset()
{ {
$invalidColumn = 'G'; $invalidColumn = 'G';
$result = $this->_testAutoFilterObject->getColumnOffset($invalidColumn); $result = $this->_testAutoFilterObject->getColumnOffset($invalidColumn);
} }
public function testSetColumnWithString() public function testSetColumnWithString()
{ {
$expectedResult = 'L'; $expectedResult = 'L';
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setColumn($expectedResult); $result = $this->_testAutoFilterObject->setColumn($expectedResult);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->_testAutoFilterObject->getColumns();
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column // Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
// objects for each column we set indexed by the column ID // objects for each column we set indexed by the column ID
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(1, count($result)); $this->assertEquals(1, count($result));
$this->assertArrayHasKey($expectedResult,$result); $this->assertArrayHasKey($expectedResult,$result);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception
*/ */
public function testSetInvalidColumnWithString() public function testSetInvalidColumnWithString()
{ {
$invalidColumn = 'A'; $invalidColumn = 'A';
$result = $this->_testAutoFilterObject->setColumn($invalidColumn); $result = $this->_testAutoFilterObject->setColumn($invalidColumn);
} }
public function testSetColumnWithColumnObject() public function testSetColumnWithColumnObject()
{ {
$expectedResult = 'M'; $expectedResult = 'M';
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($expectedResult); $columnObject = new PHPExcel_Worksheet_AutoFilter_Column($expectedResult);
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setColumn($columnObject); $result = $this->_testAutoFilterObject->setColumn($columnObject);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->_testAutoFilterObject->getColumns();
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column // Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
// objects for each column we set indexed by the column ID // objects for each column we set indexed by the column ID
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(1, count($result)); $this->assertEquals(1, count($result));
$this->assertArrayHasKey($expectedResult,$result); $this->assertArrayHasKey($expectedResult,$result);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception
*/ */
public function testSetInvalidColumnWithObject() public function testSetInvalidColumnWithObject()
{ {
$invalidColumn = 'E'; $invalidColumn = 'E';
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn); $columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn);
$result = $this->_testAutoFilterObject->setColumn($invalidColumn); $result = $this->_testAutoFilterObject->setColumn($invalidColumn);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception
*/ */
public function testSetColumnWithInvalidDataType() public function testSetColumnWithInvalidDataType()
{ {
$invalidColumn = 123.456; $invalidColumn = 123.456;
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn); $columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn);
$result = $this->_testAutoFilterObject->setColumn($invalidColumn); $result = $this->_testAutoFilterObject->setColumn($invalidColumn);
} }
public function testGetColumns() public function testGetColumns()
{ {
$columnIndexes = array('L','M'); $columnIndexes = array('L','M');
foreach($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->_testAutoFilterObject->setColumn($columnIndex);
} }
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->_testAutoFilterObject->getColumns();
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column // Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
// objects for each column we set indexed by the column ID // objects for each column we set indexed by the column ID
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(count($columnIndexes), count($result)); $this->assertEquals(count($columnIndexes), count($result));
foreach($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$this->assertArrayHasKey($columnIndex,$result); $this->assertArrayHasKey($columnIndex,$result);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$columnIndex]); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$columnIndex]);
} }
} }
public function testGetColumn() public function testGetColumn()
{ {
$columnIndexes = array('L','M'); $columnIndexes = array('L','M');
foreach($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->_testAutoFilterObject->setColumn($columnIndex);
} }
// If we request a specific column by its column ID, we should // If we request a specific column by its column ID, we should
// get a PHPExcel_Worksheet_AutoFilter_Column object returned // get a PHPExcel_Worksheet_AutoFilter_Column object returned
foreach($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$result = $this->_testAutoFilterObject->getColumn($columnIndex); $result = $this->_testAutoFilterObject->getColumn($columnIndex);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
} }
} }
public function testGetColumnByOffset() public function testGetColumnByOffset()
{ {
$columnIndexes = array( 0 => 'H', $columnIndexes = array( 0 => 'H',
3 => 'K', 3 => 'K',
5 => 'M' 5 => 'M'
); );
// If we request a specific column by its offset, we should // If we request a specific column by its offset, we should
// get a PHPExcel_Worksheet_AutoFilter_Column object returned // get a PHPExcel_Worksheet_AutoFilter_Column object returned
foreach($columnIndexes as $columnIndex => $columnID) { foreach ($columnIndexes as $columnIndex => $columnID) {
$result = $this->_testAutoFilterObject->getColumnByOffset($columnIndex); $result = $this->_testAutoFilterObject->getColumnByOffset($columnIndex);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
$this->assertEquals($result->getColumnIndex(),$columnID); $this->assertEquals($result->getColumnIndex(),$columnID);
} }
} }
public function testGetColumnIfNotSet() public function testGetColumnIfNotSet()
{ {
// If we request a specific column by its column ID, we should // If we request a specific column by its column ID, we should
// get a PHPExcel_Worksheet_AutoFilter_Column object returned // get a PHPExcel_Worksheet_AutoFilter_Column object returned
$result = $this->_testAutoFilterObject->getColumn('K'); $result = $this->_testAutoFilterObject->getColumn('K');
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception
*/ */
public function testGetColumnWithoutRangeSet() public function testGetColumnWithoutRangeSet()
{ {
// Clear the range // Clear the range
$result = $this->_testAutoFilterObject->setRange(); $result = $this->_testAutoFilterObject->setRange();
$result = $this->_testAutoFilterObject->getColumn('A'); $result = $this->_testAutoFilterObject->getColumn('A');
} }
public function testClearRangeWithExistingColumns() public function testClearRangeWithExistingColumns()
{ {
$expectedResult = ''; $expectedResult = '';
$columnIndexes = array('L','M','N'); $columnIndexes = array('L','M','N');
foreach($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->_testAutoFilterObject->setColumn($columnIndex);
} }
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setRange(); $result = $this->_testAutoFilterObject->setRange();
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
// Range should be cleared // Range should be cleared
$result = $this->_testAutoFilterObject->getRange(); $result = $this->_testAutoFilterObject->getRange();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
// Column array should be cleared // Column array should be cleared
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->_testAutoFilterObject->getColumns();
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(0, count($result)); $this->assertEquals(0, count($result));
} }
public function testSetRangeWithExistingColumns() public function testSetRangeWithExistingColumns()
{ {
$expectedResult = 'G1:J512'; $expectedResult = 'G1:J512';
// These columns should be retained // These columns should be retained
$columnIndexes1 = array('I','J'); $columnIndexes1 = array('I','J');
foreach($columnIndexes1 as $columnIndex) { foreach ($columnIndexes1 as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->_testAutoFilterObject->setColumn($columnIndex);
} }
// These columns should be discarded // These columns should be discarded
$columnIndexes2 = array('K','L','M'); $columnIndexes2 = array('K','L','M');
foreach($columnIndexes2 as $columnIndex) { foreach ($columnIndexes2 as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->_testAutoFilterObject->setColumn($columnIndex);
} }
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setRange($expectedResult); $result = $this->_testAutoFilterObject->setRange($expectedResult);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
// Range should be correctly set // Range should be correctly set
$result = $this->_testAutoFilterObject->getRange(); $result = $this->_testAutoFilterObject->getRange();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
// Only columns that existed in the original range and that // Only columns that existed in the original range and that
// still fall within the new range should be retained // still fall within the new range should be retained
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->_testAutoFilterObject->getColumns();
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(count($columnIndexes1), count($result)); $this->assertEquals(count($columnIndexes1), count($result));
} }
public function testClone() public function testClone()
{ {
$columnIndexes = array('L','M'); $columnIndexes = array('L','M');
foreach($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->_testAutoFilterObject->setColumn($columnIndex);
} }
$result = clone $this->_testAutoFilterObject; $result = clone $this->_testAutoFilterObject;
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
} }
} }

View File

@ -3,29 +3,29 @@
class CellCollectionTest extends PHPUnit_Framework_TestCase class CellCollectionTest extends PHPUnit_Framework_TestCase
{ {
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT'))
{ {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testCacheLastCell() public function testCacheLastCell()
{ {
$methods = PHPExcel_CachedObjectStorageFactory::getCacheStorageMethods(); $methods = PHPExcel_CachedObjectStorageFactory::getCacheStorageMethods();
foreach ($methods as $method) { foreach ($methods as $method) {
PHPExcel_CachedObjectStorageFactory::initialize($method); PHPExcel_CachedObjectStorageFactory::initialize($method);
$workbook = new PHPExcel(); $workbook = new PHPExcel();
$cells = array('A1', 'A2'); $cells = array('A1', 'A2');
$worksheet = $workbook->getActiveSheet(); $worksheet = $workbook->getActiveSheet();
$worksheet->setCellValue('A1', 1); $worksheet->setCellValue('A1', 1);
$worksheet->setCellValue('A2', 2); $worksheet->setCellValue('A2', 2);
$this->assertEquals($cells, $worksheet->getCellCollection(), "Cache method \"$method\"."); $this->assertEquals($cells, $worksheet->getCellCollection(), "Cache method \"$method\".");
PHPExcel_CachedObjectStorageFactory::finalize(); PHPExcel_CachedObjectStorageFactory::finalize();
} }
} }
} }

View File

@ -5,12 +5,12 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
public $mockWorksheet; public $mockWorksheet;
public $mockColumnCell; public $mockColumnCell;
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->mockCell = $this->getMockBuilder('PHPExcel_Cell') $this->mockCell = $this->getMockBuilder('PHPExcel_Cell')
->disableOriginalConstructor() ->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'); $iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A');
$ColumnCellIndexResult = 1; $ColumnCellIndexResult = 1;
$this->assertEquals($ColumnCellIndexResult, $iterator->key()); $this->assertEquals($ColumnCellIndexResult, $iterator->key());
foreach($iterator as $key => $ColumnCell) { foreach ($iterator as $key => $ColumnCell) {
$this->assertEquals($ColumnCellIndexResult++, $key); $this->assertEquals($ColumnCellIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Cell', $ColumnCell); $this->assertInstanceOf('PHPExcel_Cell', $ColumnCell);
} }
} }
public function testIteratorStartEndRange() public function testIteratorStartEndRange()
{ {
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
$ColumnCellIndexResult = 2; $ColumnCellIndexResult = 2;
$this->assertEquals($ColumnCellIndexResult, $iterator->key()); $this->assertEquals($ColumnCellIndexResult, $iterator->key());
foreach($iterator as $key => $ColumnCell) { foreach ($iterator as $key => $ColumnCell) {
$this->assertEquals($ColumnCellIndexResult++, $key); $this->assertEquals($ColumnCellIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Cell', $ColumnCell); $this->assertInstanceOf('PHPExcel_Cell', $ColumnCell);
} }
} }
public function testIteratorSeekAndPrev() public function testIteratorSeekAndPrev()
{ {
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
$columnIndexResult = 4; $columnIndexResult = 4;
$iterator->seek(4); $iterator->seek(4);
@ -64,7 +64,7 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
$iterator->prev(); $iterator->prev();
$this->assertEquals($columnIndexResult - $i, $iterator->key()); $this->assertEquals($columnIndexResult - $i, $iterator->key());
} }
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception

View File

@ -5,12 +5,12 @@ class ColumnIteratorTest extends PHPUnit_Framework_TestCase
public $mockWorksheet; public $mockWorksheet;
public $mockColumn; public $mockColumn;
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->mockColumn = $this->getMockBuilder('PHPExcel_Worksheet_Column') $this->mockColumn = $this->getMockBuilder('PHPExcel_Worksheet_Column')
->disableOriginalConstructor() ->disableOriginalConstructor()
@ -29,32 +29,32 @@ class ColumnIteratorTest extends PHPUnit_Framework_TestCase
} }
public function testIteratorFullRange() public function testIteratorFullRange()
{ {
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet); $iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet);
$columnIndexResult = 'A'; $columnIndexResult = 'A';
$this->assertEquals($columnIndexResult, $iterator->key()); $this->assertEquals($columnIndexResult, $iterator->key());
foreach($iterator as $key => $column) { foreach ($iterator as $key => $column) {
$this->assertEquals($columnIndexResult++, $key); $this->assertEquals($columnIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column); $this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
} }
} }
public function testIteratorStartEndRange() public function testIteratorStartEndRange()
{ {
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D'); $iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
$columnIndexResult = 'B'; $columnIndexResult = 'B';
$this->assertEquals($columnIndexResult, $iterator->key()); $this->assertEquals($columnIndexResult, $iterator->key());
foreach($iterator as $key => $column) { foreach ($iterator as $key => $column) {
$this->assertEquals($columnIndexResult++, $key); $this->assertEquals($columnIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column); $this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
} }
} }
public function testIteratorSeekAndPrev() public function testIteratorSeekAndPrev()
{ {
$ranges = range('A','E'); $ranges = range('A','E');
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D'); $iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
$columnIndexResult = 'D'; $columnIndexResult = 'D';
@ -66,7 +66,7 @@ class ColumnIteratorTest extends PHPUnit_Framework_TestCase
$expectedResult = $ranges[array_search($columnIndexResult, $ranges) - $i]; $expectedResult = $ranges[array_search($columnIndexResult, $ranges) - $i];
$this->assertEquals($expectedResult, $iterator->key()); $this->assertEquals($expectedResult, $iterator->key());
} }
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception

View File

@ -5,12 +5,12 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase
public $mockWorksheet; public $mockWorksheet;
public $mockRowCell; public $mockRowCell;
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->mockCell = $this->getMockBuilder('PHPExcel_Cell') $this->mockCell = $this->getMockBuilder('PHPExcel_Cell')
->disableOriginalConstructor() ->disableOriginalConstructor()
@ -29,32 +29,32 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase
} }
public function testIteratorFullRange() public function testIteratorFullRange()
{ {
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet); $iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet);
$RowCellIndexResult = 'A'; $RowCellIndexResult = 'A';
$this->assertEquals($RowCellIndexResult, $iterator->key()); $this->assertEquals($RowCellIndexResult, $iterator->key());
foreach($iterator as $key => $RowCell) { foreach ($iterator as $key => $RowCell) {
$this->assertEquals($RowCellIndexResult++, $key); $this->assertEquals($RowCellIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Cell', $RowCell); $this->assertInstanceOf('PHPExcel_Cell', $RowCell);
} }
} }
public function testIteratorStartEndRange() public function testIteratorStartEndRange()
{ {
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); $iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$RowCellIndexResult = 'B'; $RowCellIndexResult = 'B';
$this->assertEquals($RowCellIndexResult, $iterator->key()); $this->assertEquals($RowCellIndexResult, $iterator->key());
foreach($iterator as $key => $RowCell) { foreach ($iterator as $key => $RowCell) {
$this->assertEquals($RowCellIndexResult++, $key); $this->assertEquals($RowCellIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Cell', $RowCell); $this->assertInstanceOf('PHPExcel_Cell', $RowCell);
} }
} }
public function testIteratorSeekAndPrev() public function testIteratorSeekAndPrev()
{ {
$ranges = range('A','E'); $ranges = range('A','E');
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); $iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$RowCellIndexResult = 'D'; $RowCellIndexResult = 'D';
@ -66,7 +66,7 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase
$expectedResult = $ranges[array_search($RowCellIndexResult, $ranges) - $i]; $expectedResult = $ranges[array_search($RowCellIndexResult, $ranges) - $i];
$this->assertEquals($expectedResult, $iterator->key()); $this->assertEquals($expectedResult, $iterator->key());
} }
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception

View File

@ -5,12 +5,12 @@ class RowIteratorTest extends PHPUnit_Framework_TestCase
public $mockWorksheet; public $mockWorksheet;
public $mockRow; public $mockRow;
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->mockRow = $this->getMockBuilder('PHPExcel_Worksheet_Row') $this->mockRow = $this->getMockBuilder('PHPExcel_Worksheet_Row')
->disableOriginalConstructor() ->disableOriginalConstructor()
@ -29,32 +29,32 @@ class RowIteratorTest extends PHPUnit_Framework_TestCase
} }
public function testIteratorFullRange() public function testIteratorFullRange()
{ {
$iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet); $iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet);
$rowIndexResult = 1; $rowIndexResult = 1;
$this->assertEquals($rowIndexResult, $iterator->key()); $this->assertEquals($rowIndexResult, $iterator->key());
foreach($iterator as $key => $row) { foreach ($iterator as $key => $row) {
$this->assertEquals($rowIndexResult++, $key); $this->assertEquals($rowIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row); $this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
} }
} }
public function testIteratorStartEndRange() public function testIteratorStartEndRange()
{ {
$iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4); $iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4);
$rowIndexResult = 2; $rowIndexResult = 2;
$this->assertEquals($rowIndexResult, $iterator->key()); $this->assertEquals($rowIndexResult, $iterator->key());
foreach($iterator as $key => $row) { foreach ($iterator as $key => $row) {
$this->assertEquals($rowIndexResult++, $key); $this->assertEquals($rowIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row); $this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
} }
} }
public function testIteratorSeekAndPrev() public function testIteratorSeekAndPrev()
{ {
$iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4); $iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4);
$columnIndexResult = 4; $columnIndexResult = 4;
$iterator->seek(4); $iterator->seek(4);
@ -64,7 +64,7 @@ class RowIteratorTest extends PHPUnit_Framework_TestCase
$iterator->prev(); $iterator->prev();
$this->assertEquals($columnIndexResult - $i, $iterator->key()); $this->assertEquals($columnIndexResult - $i, $iterator->key());
} }
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException PHPExcel_Exception

View File

@ -5,12 +5,12 @@ class WorksheetColumnTest extends PHPUnit_Framework_TestCase
public $mockWorksheet; public $mockWorksheet;
public $mockColumn; public $mockColumn;
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet') $this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet')
->disableOriginalConstructor() ->disableOriginalConstructor()
@ -21,26 +21,26 @@ class WorksheetColumnTest extends PHPUnit_Framework_TestCase
} }
public function testInstantiateColumnDefault() public function testInstantiateColumnDefault()
{ {
$column = new PHPExcel_Worksheet_Column($this->mockWorksheet); $column = new PHPExcel_Worksheet_Column($this->mockWorksheet);
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column); $this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
$columnIndex = $column->getColumnIndex(); $columnIndex = $column->getColumnIndex();
$this->assertEquals('A', $columnIndex); $this->assertEquals('A', $columnIndex);
} }
public function testInstantiateColumnSpecified() public function testInstantiateColumnSpecified()
{ {
$column = new PHPExcel_Worksheet_Column($this->mockWorksheet, 'E'); $column = new PHPExcel_Worksheet_Column($this->mockWorksheet, 'E');
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column); $this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
$columnIndex = $column->getColumnIndex(); $columnIndex = $column->getColumnIndex();
$this->assertEquals('E', $columnIndex); $this->assertEquals('E', $columnIndex);
} }
public function testGetCellIterator() public function testGetCellIterator()
{ {
$column = new PHPExcel_Worksheet_Column($this->mockWorksheet); $column = new PHPExcel_Worksheet_Column($this->mockWorksheet);
$cellIterator = $column->getCellIterator(); $cellIterator = $column->getCellIterator();
$this->assertInstanceOf('PHPExcel_Worksheet_ColumnCellIterator', $cellIterator); $this->assertInstanceOf('PHPExcel_Worksheet_ColumnCellIterator', $cellIterator);
} }
} }

View File

@ -5,12 +5,12 @@ class WorksheetRowTest extends PHPUnit_Framework_TestCase
public $mockWorksheet; public $mockWorksheet;
public $mockRow; public $mockRow;
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet') $this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet')
->disableOriginalConstructor() ->disableOriginalConstructor()
@ -21,26 +21,26 @@ class WorksheetRowTest extends PHPUnit_Framework_TestCase
} }
public function testInstantiateRowDefault() public function testInstantiateRowDefault()
{ {
$row = new PHPExcel_Worksheet_Row($this->mockWorksheet); $row = new PHPExcel_Worksheet_Row($this->mockWorksheet);
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row); $this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
$rowIndex = $row->getRowIndex(); $rowIndex = $row->getRowIndex();
$this->assertEquals(1, $rowIndex); $this->assertEquals(1, $rowIndex);
} }
public function testInstantiateRowSpecified() public function testInstantiateRowSpecified()
{ {
$row = new PHPExcel_Worksheet_Row($this->mockWorksheet, 5); $row = new PHPExcel_Worksheet_Row($this->mockWorksheet, 5);
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row); $this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
$rowIndex = $row->getRowIndex(); $rowIndex = $row->getRowIndex();
$this->assertEquals(5, $rowIndex); $this->assertEquals(5, $rowIndex);
} }
public function testGetCellIterator() public function testGetCellIterator()
{ {
$row = new PHPExcel_Worksheet_Row($this->mockWorksheet); $row = new PHPExcel_Worksheet_Row($this->mockWorksheet);
$cellIterator = $row->getCellIterator(); $cellIterator = $row->getCellIterator();
$this->assertInstanceOf('PHPExcel_Worksheet_RowCellIterator', $cellIterator); $this->assertInstanceOf('PHPExcel_Worksheet_RowCellIterator', $cellIterator);
} }
} }

View File

@ -54,11 +54,11 @@ class testDataFileIterator implements Iterator
} while (($testDataRow > '') && ($testDataRow{0} === '#')); } while (($testDataRow > '') && ($testDataRow{0} === '#'));
// Discard any comments at the end of the line // 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 // Split data into an array of individual values and a result
$dataSet = $this->_getcsv($testData, ',', "'"); $dataSet = $this->_getcsv($testData, ',', "'");
foreach($dataSet as &$dataValue) { foreach ($dataSet as &$dataValue) {
$dataValue = $this->_parseDataValue($dataValue); $dataValue = $this->_parseDataValue($dataValue);
} }
unset($dataValue); unset($dataValue);
@ -85,23 +85,24 @@ class testDataFileIterator implements Iterator
return $data; return $data;
} }
private function _parseDataValue($dataValue) { private function _parseDataValue($dataValue)
{
// discard any white space // discard any white space
$dataValue = trim($dataValue); $dataValue = trim($dataValue);
// test for the required datatype and convert accordingly // test for the required datatype and convert accordingly
if (!is_numeric($dataValue)) { if (!is_numeric($dataValue)) {
if($dataValue == '') { if($dataValue == '') {
$dataValue = NULL; $dataValue = null;
} elseif($dataValue == '""') { } elseif($dataValue == '""') {
$dataValue = ''; $dataValue = '';
} elseif(($dataValue[0] == '"') && ($dataValue[strlen($dataValue)-1] == '"')) { } elseif(($dataValue[0] == '"') && ($dataValue[strlen($dataValue)-1] == '"')) {
$dataValue = substr($dataValue,1,-1); $dataValue = substr($dataValue,1,-1);
} elseif(($dataValue[0] == '{') && ($dataValue[strlen($dataValue)-1] == '}')) { } elseif(($dataValue[0] == '{') && ($dataValue[strlen($dataValue)-1] == '}')) {
$dataValue = explode(';',substr($dataValue,1,-1)); $dataValue = explode(';',substr($dataValue,1,-1));
foreach($dataValue as &$dataRow) { foreach ($dataValue as &$dataRow) {
if (strpos($dataRow,'|') !== FALSE) { if (strpos($dataRow,'|') !== false) {
$dataRow = explode('|',$dataRow); $dataRow = explode('|',$dataRow);
foreach($dataRow as &$dataCell) { foreach ($dataRow as &$dataCell) {
$dataCell = $this->_parseDataValue($dataCell); $dataCell = $this->_parseDataValue($dataCell);
} }
unset($dataCell); unset($dataCell);
@ -112,20 +113,25 @@ class testDataFileIterator implements Iterator
unset($dataRow); unset($dataRow);
} else { } else {
switch (strtoupper($dataValue)) { switch (strtoupper($dataValue)) {
case 'NULL' : $dataValue = NULL; break; case 'NULL':
case 'TRUE' : $dataValue = TRUE; break; $dataValue = null;
case 'FALSE' : $dataValue = FALSE; break; break;
case 'TRUE':
$dataValue = true;
break;
case 'FALSE':
$dataValue = false;
break;
} }
} }
} else { } else {
if (strpos($dataValue,'.') !== FALSE) { if (strpos($dataValue,'.') !== false) {
$dataValue = (float) $dataValue; $dataValue = (float) $dataValue;
} else { } else {
$dataValue = (int) $dataValue; $dataValue = (int) $dataValue;
} }
} }
return $dataValue; return $dataValue;
} }
} }