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

View File

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

View File

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

View File

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