started unit test fixed error for Spreadsheet_Excel_Writer_Workbook::setVersion()

This commit is contained in:
stevleibelt 2016-01-17 21:24:28 +01:00
parent 8b1d66e09a
commit 3d299d9938
9 changed files with 95 additions and 25 deletions

View File

@ -42,18 +42,24 @@
class Spreadsheet_Excel_Writer_Format extends PEAR class Spreadsheet_Excel_Writer_Format extends PEAR
{ {
/**
* The BIFF version for the workbook
* @var integer
*/
public $_BIFF_version;
/**
* Index to the FONT record.
* @var integer
*/
public $font_index;
/** /**
* The index given by the workbook when creating a new format. * The index given by the workbook when creating a new format.
* @var integer * @var integer
*/ */
protected $_xf_index; protected $_xf_index;
/**
* Index to the FONT record.
* @var integer
*/
public $font_index;
/** /**
* The font name (ASCII). * The font name (ASCII).
* @var string * @var string
@ -244,6 +250,7 @@ class Spreadsheet_Excel_Writer_Format extends PEAR
* Constructor * Constructor
* *
* @access private * @access private
* @param integer $BIFF_version
* @param integer $index the XF index for the format. * @param integer $index the XF index for the format.
* @param array $properties array with properties to be set on initialization. * @param array $properties array with properties to be set on initialization.
*/ */
@ -1096,7 +1103,7 @@ class Spreadsheet_Excel_Writer_Format extends PEAR
* Sets the font family name. * Sets the font family name.
* *
* @access public * @access public
* @param string $fontfamily The font family name. Possible values are: * @param string $font_family The font family name. Possible values are:
* 'Times New Roman', 'Arial', 'Courier'. * 'Times New Roman', 'Arial', 'Courier'.
*/ */
public function setFontFamily($font_family) public function setFontFamily($font_family)

View File

@ -107,6 +107,12 @@ define('SPREADSHEET_EXCEL_WRITER_CONCAT', '&');
class Spreadsheet_Excel_Writer_Parser extends PEAR class Spreadsheet_Excel_Writer_Parser extends PEAR
{ {
/**
* The BIFF version for the workbook
* @var integer
*/
public $_BIFF_version;
/** /**
* The index of the character we are currently looking at * The index of the character we are currently looking at
* @var integer * @var integer
@ -125,6 +131,11 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR
*/ */
protected $_formula; protected $_formula;
/**
* @var array
*/
protected $_functions;
/** /**
* The character ahead of the current char * The character ahead of the current char
* @var string * @var string
@ -155,17 +166,12 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR
*/ */
protected $_references; protected $_references;
/**
* The BIFF version for the workbook
* @var integer
*/
protected $_BIFF_version;
/** /**
* The class constructor * The class constructor
* *
* @param integer $byte_order The byte order (Little endian or Big endian) of the architecture * @param integer $byte_order The byte order (Little endian or Big endian) of the architecture
(optional). 1 => big endian, 0 (default) little endian. * (optional). 1 => big endian, 0 (default) little endian.
* @param integer $biff_version
*/ */
public function __construct($byte_order, $biff_version) public function __construct($byte_order, $biff_version)
{ {
@ -597,6 +603,7 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR
* *
* @access private * @access private
* @param mixed $num an integer or double for conversion to its ptg value * @param mixed $num an integer or double for conversion to its ptg value
* @return string
*/ */
protected function _convertNumber($num) protected function _convertNumber($num)
{ {
@ -660,11 +667,13 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR
} }
/** /**
* Convert an Excel range such as A1:D4 to a ptgRefV. * Convert an Excel range such as A1:D4 to a ptgRefV.
* *
* @access private * @access private
* @param string $range An Excel range in the A1:A2 or A1..A2 format. * @param string $range An Excel range in the A1:A2 or A1..A2 format.
*/ * @param int $class
* @return array|string
*/
protected function _convertRange2d($range, $class=0) protected function _convertRange2d($range, $class=0)
{ {

View File

@ -55,7 +55,7 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri
/** /**
* Formula parser * Formula parser
* @var object Parser * @var Spreadsheet_Excel_Writer_Parser
*/ */
protected $parser; protected $parser;
@ -111,7 +111,7 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri
/** /**
* The default XF format. * The default XF format.
* @var object Format * @var Spreadsheet_Excel_Writer_Format
*/ */
protected $temporaryFormat; protected $temporaryFormat;
@ -141,7 +141,7 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri
/** /**
* The default format for URLs. * The default format for URLs.
* @var object Format * @var Spreadsheet_Excel_Writer_Format
*/ */
protected $urlFormat; protected $urlFormat;

View File

@ -59,13 +59,13 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
/** /**
* Reference to the (default) Format object for URLs * Reference to the (default) Format object for URLs
* @var object Format * @var Spreadsheet_Excel_Writer_Format
*/ */
protected $_url_format; protected $_url_format;
/** /**
* Reference to the parser used for parsing formulas * Reference to the parser used for parsing formulas
* @var object Format * @var Spreadsheet_Excel_Writer_Format
*/ */
protected $_parser; protected $_parser;

View File

@ -23,7 +23,8 @@
], ],
"autoload": { "autoload": {
"psr-0": { "psr-0": {
"Spreadsheet": "./" "Spreadsheet": "./",
"Test": "./test"
} }
}, },
"description": "More info available on: http://pear.php.net/package/Spreadsheet_Excel_Writer", "description": "More info available on: http://pear.php.net/package/Spreadsheet_Excel_Writer",

17
phpunit.xml.dist Normal file
View File

@ -0,0 +1,17 @@
<phpunit bootstrap="test/bootstrap.php"
cacheTokens="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false">
<testsuites>
<testsuite name="Test Suite">
<directory>test/</directory>
</testsuite>
</testsuites>
</phpunit>

View File

@ -0,0 +1,17 @@
<?php
/**
* @author stev leibelt <artodeto@bazzline.net>
* @since 2016-01-17
*/
class Test_Spreadsheet_Excel_WriterTestCase extends PHPUnit_Framework_TestCase
{
/**
* @param string $fileName
* @return Spreadsheet_Excel_Writer_Workbook
*/
protected function getNewWorkbook($fileName = 'my_workbook')
{
return new Spreadsheet_Excel_Writer_Workbook($fileName);
}
}

View File

@ -0,0 +1,15 @@
<?php
/**
* @author stev leibelt <artodeto@bazzline.net>
* @since 2016-01-17
*/
class Test_Spreadsheet_Excel_Writer_WorkbookTest extends Test_Spreadsheet_Excel_WriterTestCase
{
public function testSetVersion()
{
$workbook = $this->getNewWorkbook();
$workbook->setVersion(8);
}
}

4
test/bootstrap.php Normal file
View File

@ -0,0 +1,4 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/Test/Spreadsheet/Excel/Writer/Test_Spreadsheet_Excel_WriterTestCase.php'; //@todo fix this