Fix tests with no locales + Apply CSFixer fixes
This commit is contained in:
parent
f8595e9d63
commit
0345b369c7
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -158,7 +158,7 @@ jobs:
|
|||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Run PHP-CS-Fixer
|
- name: Run PHP-CS-Fixer
|
||||||
run: vendor/bin/php-cs-fixer fix --config=.php_cs.dist --verbose --diff --dry-run --diff-format=udiff
|
run: vendor/bin/php-cs-fixer fix --verbose --diff --dry-run --diff-format=udiff
|
||||||
|
|
||||||
static-analysis:
|
static-analysis:
|
||||||
name: Static Analysis
|
name: Static Analysis
|
||||||
|
@ -19,7 +19,7 @@ $config = PhpCsFixer\Config::create()
|
|||||||
'no_break_comment' => ['comment_text' => 'do nothing'],
|
'no_break_comment' => ['comment_text' => 'do nothing'],
|
||||||
'no_empty_phpdoc' => false,
|
'no_empty_phpdoc' => false,
|
||||||
'no_null_property_initialization' => true,
|
'no_null_property_initialization' => true,
|
||||||
'no_short_echo_tag' => true,
|
'echo_tag_syntax' => false,
|
||||||
'no_superfluous_elseif' => true,
|
'no_superfluous_elseif' => true,
|
||||||
'no_superfluous_phpdoc_tags' => false,
|
'no_superfluous_phpdoc_tags' => false,
|
||||||
'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'switch_case', 'yield']],
|
'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'switch_case', 'yield']],
|
||||||
@ -37,7 +37,7 @@ $config = PhpCsFixer\Config::create()
|
|||||||
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
|
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
|
||||||
'phpdoc_separation' => false,
|
'phpdoc_separation' => false,
|
||||||
'protected_to_private' => true,
|
'protected_to_private' => true,
|
||||||
'psr4' => true,
|
'psr_autoloading' => true,
|
||||||
'return_type_declaration' => ['space_before' => 'one'],
|
'return_type_declaration' => ['space_before' => 'one'],
|
||||||
'semicolon_after_instruction' => true,
|
'semicolon_after_instruction' => true,
|
||||||
'simplified_null_return' => false,
|
'simplified_null_return' => false,
|
@ -291,12 +291,19 @@ class WriterTest extends TestCase
|
|||||||
// Installed locales differ from one system to another, so we can't pick
|
// Installed locales differ from one system to another, so we can't pick
|
||||||
// a given locale.
|
// a given locale.
|
||||||
$supportedLocales = explode("\n", shell_exec('locale -a'));
|
$supportedLocales = explode("\n", shell_exec('locale -a'));
|
||||||
|
$foundCommaLocale = false;
|
||||||
foreach ($supportedLocales as $supportedLocale) {
|
foreach ($supportedLocales as $supportedLocale) {
|
||||||
\setlocale(LC_ALL, $supportedLocale);
|
\setlocale(LC_ALL, $supportedLocale);
|
||||||
if (\localeconv()['decimal_point'] === ',') {
|
if (\localeconv()['decimal_point'] === ',') {
|
||||||
|
$foundCommaLocale = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$foundCommaLocale) {
|
||||||
|
$this->markTestSkipped('No locale with comma decimal separator');
|
||||||
|
}
|
||||||
|
|
||||||
$this->assertEquals(',', \localeconv()['decimal_point']);
|
$this->assertEquals(',', \localeconv()['decimal_point']);
|
||||||
|
|
||||||
$fileName = 'test_add_row_should_support_float_values_in_different_locale.xlsx';
|
$fileName = 'test_add_row_should_support_float_values_in_different_locale.xlsx';
|
||||||
@ -306,8 +313,8 @@ class WriterTest extends TestCase
|
|||||||
|
|
||||||
$this->writeToODSFile($dataRows, $fileName);
|
$this->writeToODSFile($dataRows, $fileName);
|
||||||
|
|
||||||
$this->assertValueWasNotWrittenToSheet($fileName, 1, "1234,5");
|
$this->assertValueWasNotWrittenToSheet($fileName, 1, '1234,5');
|
||||||
$this->assertValueWasWrittenToSheet($fileName, 1, "1234.5");
|
$this->assertValueWasWrittenToSheet($fileName, 1, '1234.5');
|
||||||
} finally {
|
} finally {
|
||||||
// reset locale
|
// reset locale
|
||||||
\setlocale(LC_ALL, $previousLocale);
|
\setlocale(LC_ALL, $previousLocale);
|
||||||
|
@ -406,12 +406,19 @@ class WriterTest extends TestCase
|
|||||||
// Installed locales differ from one system to another, so we can't pick
|
// Installed locales differ from one system to another, so we can't pick
|
||||||
// a given locale.
|
// a given locale.
|
||||||
$supportedLocales = explode("\n", shell_exec('locale -a'));
|
$supportedLocales = explode("\n", shell_exec('locale -a'));
|
||||||
|
$foundCommaLocale = false;
|
||||||
foreach ($supportedLocales as $supportedLocale) {
|
foreach ($supportedLocales as $supportedLocale) {
|
||||||
\setlocale(LC_ALL, $supportedLocale);
|
\setlocale(LC_ALL, $supportedLocale);
|
||||||
if (\localeconv()['decimal_point'] === ',') {
|
if (\localeconv()['decimal_point'] === ',') {
|
||||||
|
$foundCommaLocale = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$foundCommaLocale) {
|
||||||
|
$this->markTestSkipped('No locale with comma decimal separator');
|
||||||
|
}
|
||||||
|
|
||||||
$this->assertEquals(',', \localeconv()['decimal_point']);
|
$this->assertEquals(',', \localeconv()['decimal_point']);
|
||||||
|
|
||||||
$fileName = 'test_add_row_should_support_float_values_in_different_locale.xlsx';
|
$fileName = 'test_add_row_should_support_float_values_in_different_locale.xlsx';
|
||||||
@ -421,8 +428,8 @@ class WriterTest extends TestCase
|
|||||||
|
|
||||||
$this->writeToXLSXFile($dataRows, $fileName, $shouldUseInlineStrings = false);
|
$this->writeToXLSXFile($dataRows, $fileName, $shouldUseInlineStrings = false);
|
||||||
|
|
||||||
$this->assertInlineDataWasNotWrittenToSheet($fileName, 1, "1234,5");
|
$this->assertInlineDataWasNotWrittenToSheet($fileName, 1, '1234,5');
|
||||||
$this->assertInlineDataWasWrittenToSheet($fileName, 1, "1234.5");
|
$this->assertInlineDataWasWrittenToSheet($fileName, 1, '1234.5');
|
||||||
} finally {
|
} finally {
|
||||||
// reset locale
|
// reset locale
|
||||||
\setlocale(LC_ALL, $previousLocale);
|
\setlocale(LC_ALL, $previousLocale);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user