Merge ac63d39dd7fd9a19a6b11138ef6e8720f97e059f into 9533accd73edc020072bc7a4f0c0ddb28a5b701f
This commit is contained in:
commit
2fbe12cc89
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$config = PhpCsFixer\Config::create()
|
$config = (new PhpCsFixer\Config())
|
||||||
->setRiskyAllowed(true)
|
->setRiskyAllowed(true)
|
||||||
->setRules([
|
->setRules([
|
||||||
'@Symfony' => true,
|
'@Symfony' => true,
|
||||||
@ -13,13 +13,14 @@ $config = PhpCsFixer\Config::create()
|
|||||||
'declare_equal_normalize' => ['space' => 'single'],
|
'declare_equal_normalize' => ['space' => 'single'],
|
||||||
'heredoc_to_nowdoc' => true,
|
'heredoc_to_nowdoc' => true,
|
||||||
'increment_style' => ['style' => 'post'],
|
'increment_style' => ['style' => 'post'],
|
||||||
'is_null' => ['use_yoda_style' => false],
|
'method_argument_space' => [
|
||||||
'method_argument_space' => ['ensure_fully_multiline' => true],
|
'on_multiline' => 'ensure_fully_multiline'
|
||||||
|
],
|
||||||
'modernize_types_casting' => true,
|
'modernize_types_casting' => true,
|
||||||
'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 +38,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,
|
@ -42,7 +42,7 @@ before_script:
|
|||||||
script:
|
script:
|
||||||
- |
|
- |
|
||||||
if [[ "$WITH_CS" == "true" ]]; then
|
if [[ "$WITH_CS" == "true" ]]; then
|
||||||
vendor/bin/php-cs-fixer fix --config=.php_cs.dist --verbose --diff --dry-run --diff-format=udiff
|
vendor/bin/php-cs-fixer fix --verbose --diff --dry-run --diff-format=udiff
|
||||||
fi
|
fi
|
||||||
- |
|
- |
|
||||||
if [[ "$WITH_PHPUNIT" == "true" ]]; then
|
if [[ "$WITH_PHPUNIT" == "true" ]]; then
|
||||||
|
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
FROM php:7.2-cli
|
||||||
|
|
||||||
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||||
|
libzip-dev \
|
||||||
|
locales \
|
||||||
|
locales-all \
|
||||||
|
zip \
|
||||||
|
&& docker-php-ext-configure zip --with-libzip \
|
||||||
|
&& docker-php-ext-install zip
|
||||||
|
|
||||||
|
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
|
||||||
|
RUN chmod +x /usr/local/bin/composer
|
19
README.md
19
README.md
@ -40,6 +40,25 @@ For information, the performance tests take about 10 minutes to run (processing
|
|||||||
|
|
||||||
> Performance tests status: [](https://travis-ci.org/box/spout)
|
> Performance tests status: [](https://travis-ci.org/box/spout)
|
||||||
|
|
||||||
|
### Running test with Docker
|
||||||
|
|
||||||
|
First install the dependencies with docker-compose
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose run --rm -u ${UID} php composer install
|
||||||
|
```
|
||||||
|
|
||||||
|
Then launch the PHPUnit tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose run --rm php vendor/bin/phpunit
|
||||||
|
```
|
||||||
|
|
||||||
|
Same for CS Fixer tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose run --rm php vendor/bin/php-cs-fixer fix --verbose --diff --dry-run --diff-format=udiff
|
||||||
|
```
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
|
8
docker-compose.yml
Normal file
8
docker-compose.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
php:
|
||||||
|
build: .
|
||||||
|
working_dir: /srv/spout
|
||||||
|
volumes:
|
||||||
|
- $PWD:/srv/spout
|
||||||
|
- $PWD/tests/generated/resources/unwritable:/srv/spout/tests/resources/generated/unwritable:ro
|
@ -291,12 +291,17 @@ 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 +311,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,17 @@ 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 +426,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