Fix unit tests for function list markdown, and style issues for DOLLAR/USDOLLAR

This commit is contained in:
MarkBaker 2021-05-20 18:53:41 +02:00 committed by Mark Baker
parent f89bfc9e02
commit 65309dbe78
4 changed files with 49 additions and 49 deletions

View File

@ -2,8 +2,10 @@
namespace PhpOffice\PhpSpreadsheetInfra;
use Exception;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Column;
use PhpOffice\PhpSpreadsheet\Worksheet\Row;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
@ -25,24 +27,24 @@ class LocaleGenerator
private const ENGLISH_REFERENCE_COLUMN = 'B';
/**
* @var string $translationSpreadsheetName
* @var string
*/
protected $translationSpreadsheetName;
/**
* @var string $translationBaseFolder
* @var string
*/
protected $translationBaseFolder;
protected $phpSpreadsheetFunctions;
/**
* @var Spreadsheet $translationSpreadsheet
* @var Spreadsheet
*/
protected $translationSpreadsheet;
/**
* @var Worksheet $localeTranslations
* @var Worksheet
*/
protected $localeTranslations;
@ -51,7 +53,7 @@ class LocaleGenerator
protected $errorCodeMap = [];
/**
* @var Worksheet $functionNameTranslations
* @var Worksheet
*/
private $functionNameTranslations;
@ -69,7 +71,7 @@ class LocaleGenerator
$this->phpSpreadsheetFunctions = $phpSpreadsheetFunctions;
}
public function generateLocales()
public function generateLocales(): void
{
$this->openTranslationWorkbook();
@ -90,7 +92,7 @@ class LocaleGenerator
}
}
protected function buildConfigFileForLocale($column, $locale)
protected function buildConfigFileForLocale($column, $locale): void
{
$language = $this->localeTranslations->getCell($column . self::ENGLISH_LANGUAGE_NAME_ROW)->getValue();
$localeLanguage = $this->localeTranslations->getCell($column . self::LOCALE_LANGUAGE_NAME_ROW)->getValue();
@ -114,7 +116,7 @@ class LocaleGenerator
fclose($configFile);
}
protected function writeConfigArgumentSeparator($configFile, $column)
protected function writeConfigArgumentSeparator($configFile, $column): void
{
$translationCell = $this->localeTranslations->getCell($column . self::ARGUMENT_SEPARATOR_ROW);
$localeValue = $translationCell->getValue();
@ -122,11 +124,11 @@ class LocaleGenerator
$functionTranslation = "ArgumentSeparator = {$localeValue}" . PHP_EOL;
fwrite($configFile, $functionTranslation);
} else {
echo "No Argument Separator defined", PHP_EOL;
echo 'No Argument Separator defined', PHP_EOL;
}
}
protected function buildFunctionsFileForLocale($column, $locale)
protected function buildFunctionsFileForLocale($column, $locale): void
{
$language = $this->functionNameTranslations->getCell($column . self::ENGLISH_LANGUAGE_NAME_ROW)->getValue();
$localeLanguage = $this->functionNameTranslations->getCell($column . self::LOCALE_LANGUAGE_NAME_ROW)
@ -159,7 +161,7 @@ class LocaleGenerator
$configFileName = realpath($localeFolder . DIRECTORY_SEPARATOR . 'config');
echo "Writing locale configuration to {$configFileName}", PHP_EOL;
$configFile = fopen($configFileName, 'w');
$configFile = fopen($configFileName, 'wb');
$this->writeFileHeader($configFile, $localeLanguage, $language, 'locale settings');
return $configFile;
@ -173,7 +175,7 @@ class LocaleGenerator
$functionFileName = realpath($localeFolder . DIRECTORY_SEPARATOR . 'functions');
echo "Writing local function names to {$functionFileName}", PHP_EOL;
$functionFile = fopen($functionFileName, 'w');
$functionFile = fopen($functionFileName, 'wb');
$this->writeFileHeader($functionFile, $localeLanguage, $language, 'function name translations');
return $functionFile;
@ -300,6 +302,7 @@ class LocaleGenerator
echo 'CATEGORY: ', $cell->getValue(), PHP_EOL;
$this->functionNameMap[$cell->getValue()] = $cell->getRow();
}
continue;
}
if ($cell->getValue() != '') {

View File

@ -2,9 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\Financial;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Round;
use PhpOffice\PhpSpreadsheet\Calculation\TextData\Format;
class Dollar

View File

@ -11,7 +11,6 @@ class UsDollarTest extends TestCase
* @dataProvider providerUSDOLLAR
*
* @param mixed $expectedResult
* @param mixed $message
*/
public function testUSDOLLAR($expectedResult, ...$args): void
{

View File

@ -41,16 +41,16 @@ class DocumentGeneratorTest extends TestCase
## A
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
ABS | CATEGORY_MATH_AND_TRIG | abs
AND | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
Excel Function | Category | PhpSpreadsheet Function
-------------------------|--------------------------------|--------------------------------------
ABS | CATEGORY_MATH_AND_TRIG | abs
AND | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
## I
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
IFS | CATEGORY_LOGICAL | **Not yet Implemented**
Excel Function | Category | PhpSpreadsheet Function
-------------------------|--------------------------------|--------------------------------------
IFS | CATEGORY_LOGICAL | **Not yet Implemented**
EXPECTED
@ -72,66 +72,66 @@ EXPECTED
## CATEGORY_CUBE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
## CATEGORY_DATABASE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
## CATEGORY_DATE_AND_TIME
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
## CATEGORY_ENGINEERING
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
## CATEGORY_FINANCIAL
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
## CATEGORY_INFORMATION
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
## CATEGORY_LOGICAL
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
AND | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
IFS | **Not yet Implemented**
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
AND | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
IFS | **Not yet Implemented**
## CATEGORY_LOOKUP_AND_REFERENCE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
## CATEGORY_MATH_AND_TRIG
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
ABS | abs
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
ABS | abs
## CATEGORY_STATISTICAL
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
## CATEGORY_TEXT_AND_DATA
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
## CATEGORY_WEB
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
Excel Function | PhpSpreadsheet Function
-------------------------|--------------------------------------
EXPECTED