Skip to content

Commit

Permalink
Merge pull request #88 from chadicus/fea/string-compress
Browse files Browse the repository at this point in the history
Add compress-string Alias
  • Loading branch information
chadicus committed Mar 20, 2019
2 parents 7863100 + 3667ddb commit a8dec17
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"traderinteractive/filter-dates": "^3.0",
"traderinteractive/filter-floats": "^3.0",
"traderinteractive/filter-ints": "^3.0",
"traderinteractive/filter-strings": "^3.3.1"
"traderinteractive/filter-strings": "^3.3.2"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.0",
Expand Down
1 change: 1 addition & 0 deletions src/Filterer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ final class Filterer implements FiltererInterface
'arrayize' => '\\TraderInteractive\\Filter\\Arrays::arrayize',
'bool' => '\\TraderInteractive\\Filter\\Booleans::filter',
'bool-convert' => '\\TraderInteractive\\Filter\\Booleans::convert',
'compress-string' => '\\TraderInteractive\\Filter\\Strings::compress',
'concat' => '\\TraderInteractive\\Filter\\Strings::concat',
'date' => '\\TraderInteractive\\Filter\\DateTime::filter',
'date-format' => '\\TraderInteractive\\Filter\\DateTime::format',
Expand Down
12 changes: 12 additions & 0 deletions tests/FiltererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,18 @@ public function provideValidFilterData() : array
'options' => [],
'result' => [true, ['field' => 'one or *****'], null, []],
],
'compress-string alias' => [
'spec' => ['field' => [['compress-string']]],
'input' => ['field' => ' a string with extra spaces '],
'options' => [],
'result' => [true, ['field' => 'a string with extra spaces'], null, []],
],
'compress-string alias include newlines' => [
'spec' => ['field' => [['compress-string', true]]],
'input' => ['field' => " a string\n with\nnewlines and extra spaces\n "],
'options' => [],
'result' => [true, ['field' => 'a string with newlines and extra spaces'], null, []],
],
];
}

Expand Down

0 comments on commit a8dec17

Please sign in to comment.