Improve test code (#1002)
* Enhancements suggested by scrutiniser * Styling
This commit is contained in:
parent
d6018a273e
commit
dd656b4c53
|
@ -52,25 +52,25 @@ $row = 2;
|
||||||
foreach ($years as $year) {
|
foreach ($years as $year) {
|
||||||
foreach ($periods as $period) {
|
foreach ($periods as $period) {
|
||||||
foreach ($countries as $country) {
|
foreach ($countries as $country) {
|
||||||
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
|
$endDays = date('t', mktime(0, 0, 0, $period, 1, (int) $year));
|
||||||
for ($i = 1; $i <= $endDays; ++$i) {
|
for ($i = 1; $i <= $endDays; ++$i) {
|
||||||
$eDate = Date::formattedPHPToExcel(
|
$eDate = Date::formattedPHPToExcel(
|
||||||
$year,
|
$year,
|
||||||
$period,
|
$period,
|
||||||
$i
|
$i
|
||||||
);
|
);
|
||||||
$value = rand(500, 1000) * (1 + rand(-0.25, +0.25));
|
$value = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||||
$salesValue = $invoiceValue = null;
|
$salesValue = $invoiceValue = null;
|
||||||
$incomeOrExpenditure = rand(-1, 1);
|
$incomeOrExpenditure = rand(-1, 1);
|
||||||
if ($incomeOrExpenditure == -1) {
|
if ($incomeOrExpenditure == -1) {
|
||||||
$expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25));
|
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||||
$income = null;
|
$income = null;
|
||||||
} elseif ($incomeOrExpenditure == 1) {
|
} elseif ($incomeOrExpenditure == 1) {
|
||||||
$expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25));
|
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||||
$income = rand(500, 1000) * (1 + rand(-0.25, +0.25));
|
$income = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||||
} else {
|
} else {
|
||||||
$expenditure = null;
|
$expenditure = null;
|
||||||
$income = rand(500, 1000) * (1 + rand(-0.25, +0.25));
|
$income = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||||
}
|
}
|
||||||
$dataArray = [$year,
|
$dataArray = [$year,
|
||||||
$period,
|
$period,
|
||||||
|
|
|
@ -52,25 +52,25 @@ $row = 2;
|
||||||
foreach ($years as $year) {
|
foreach ($years as $year) {
|
||||||
foreach ($periods as $period) {
|
foreach ($periods as $period) {
|
||||||
foreach ($countries as $country) {
|
foreach ($countries as $country) {
|
||||||
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
|
$endDays = date('t', mktime(0, 0, 0, $period, 1, (int) $year));
|
||||||
for ($i = 1; $i <= $endDays; ++$i) {
|
for ($i = 1; $i <= $endDays; ++$i) {
|
||||||
$eDate = Date::formattedPHPToExcel(
|
$eDate = Date::formattedPHPToExcel(
|
||||||
$year,
|
$year,
|
||||||
$period,
|
$period,
|
||||||
$i
|
$i
|
||||||
);
|
);
|
||||||
$value = rand(500, 1000) * (1 + rand(-0.25, +0.25));
|
$value = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||||
$salesValue = $invoiceValue = null;
|
$salesValue = $invoiceValue = null;
|
||||||
$incomeOrExpenditure = rand(-1, 1);
|
$incomeOrExpenditure = rand(-1, 1);
|
||||||
if ($incomeOrExpenditure == -1) {
|
if ($incomeOrExpenditure == -1) {
|
||||||
$expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25));
|
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||||
$income = null;
|
$income = null;
|
||||||
} elseif ($incomeOrExpenditure == 1) {
|
} elseif ($incomeOrExpenditure == 1) {
|
||||||
$expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25));
|
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||||
$income = rand(500, 1000) * (1 + rand(-0.25, +0.25));
|
$income = rand(500, 1000) * (1 + rand(-0.25, +0.25));
|
||||||
} else {
|
} else {
|
||||||
$expenditure = null;
|
$expenditure = null;
|
||||||
$income = rand(500, 1000) * (1 + rand(-0.25, +0.25));
|
$income = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||||
}
|
}
|
||||||
$dataArray = [$year,
|
$dataArray = [$year,
|
||||||
$period,
|
$period,
|
||||||
|
|
|
@ -52,25 +52,25 @@ $row = 2;
|
||||||
foreach ($years as $year) {
|
foreach ($years as $year) {
|
||||||
foreach ($periods as $period) {
|
foreach ($periods as $period) {
|
||||||
foreach ($countries as $country) {
|
foreach ($countries as $country) {
|
||||||
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
|
$endDays = date('t', mktime(0, 0, 0, $period, 1, (int) $year));
|
||||||
for ($i = 1; $i <= $endDays; ++$i) {
|
for ($i = 1; $i <= $endDays; ++$i) {
|
||||||
$eDate = Date::formattedPHPToExcel(
|
$eDate = Date::formattedPHPToExcel(
|
||||||
$year,
|
$year,
|
||||||
$period,
|
$period,
|
||||||
$i
|
$i
|
||||||
);
|
);
|
||||||
$value = rand(500, 1000) * (1 + rand(-0.25, +0.25));
|
$value = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||||
$salesValue = $invoiceValue = null;
|
$salesValue = $invoiceValue = null;
|
||||||
$incomeOrExpenditure = rand(-1, 1);
|
$incomeOrExpenditure = rand(-1, 1);
|
||||||
if ($incomeOrExpenditure == -1) {
|
if ($incomeOrExpenditure == -1) {
|
||||||
$expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25));
|
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||||
$income = null;
|
$income = null;
|
||||||
} elseif ($incomeOrExpenditure == 1) {
|
} elseif ($incomeOrExpenditure == 1) {
|
||||||
$expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25));
|
$expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4));
|
||||||
$income = rand(500, 1000) * (1 + rand(-0.25, +0.25));
|
$income = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||||
} else {
|
} else {
|
||||||
$expenditure = null;
|
$expenditure = null;
|
||||||
$income = rand(500, 1000) * (1 + rand(-0.25, +0.25));
|
$income = rand(500, 1000) * (1 + (rand(-1, 1) / 4));
|
||||||
}
|
}
|
||||||
$dataArray = [$year,
|
$dataArray = [$year,
|
||||||
$period,
|
$period,
|
||||||
|
|
|
@ -55,6 +55,11 @@ abstract class BaseReader implements IReader
|
||||||
*/
|
*/
|
||||||
protected $securityScanner;
|
protected $securityScanner;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->readFilter = new DefaultReadFilter();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read data only?
|
* Read data only?
|
||||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Csv extends BaseReader
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->readFilter = new DefaultReadFilter();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Gnumeric extends BaseReader
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->readFilter = new DefaultReadFilter();
|
parent::__construct();
|
||||||
$this->referenceHelper = ReferenceHelper::getInstance();
|
$this->referenceHelper = ReferenceHelper::getInstance();
|
||||||
$this->securityScanner = XmlScanner::getInstance($this);
|
$this->securityScanner = XmlScanner::getInstance($this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ class Html extends BaseReader
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->readFilter = new DefaultReadFilter();
|
parent::__construct();
|
||||||
$this->securityScanner = XmlScanner::getInstance($this);
|
$this->securityScanner = XmlScanner::getInstance($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Ods extends BaseReader
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->readFilter = new DefaultReadFilter();
|
parent::__construct();
|
||||||
$this->securityScanner = XmlScanner::getInstance($this);
|
$this->securityScanner = XmlScanner::getInstance($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Slk extends BaseReader
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->readFilter = new DefaultReadFilter();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -412,7 +412,7 @@ class Xls extends BaseReader
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->readFilter = new DefaultReadFilter();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Xlsx extends BaseReader
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->readFilter = new DefaultReadFilter();
|
parent::__construct();
|
||||||
$this->referenceHelper = ReferenceHelper::getInstance();
|
$this->referenceHelper = ReferenceHelper::getInstance();
|
||||||
$this->securityScanner = XmlScanner::getInstance($this);
|
$this->securityScanner = XmlScanner::getInstance($this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Xml extends BaseReader
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->readFilter = new DefaultReadFilter();
|
parent::__construct();
|
||||||
$this->securityScanner = XmlScanner::getInstance($this);
|
$this->securityScanner = XmlScanner::getInstance($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue