diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-12-13 11:12:03 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-12-13 11:12:03 -0500 |
commit | ff26cce361f123de7fa9f1bc9989bad88f19b7f3 (patch) | |
tree | c58ac225ffb81d8be52f5e0da8b8d8de560845bc | |
parent | 486238b5485d61cdc4e66244632f91357d014059 (diff) |
Add new boolean value for CSV import
-rw-r--r-- | app/Core/Csv.php | 2 | ||||
-rw-r--r-- | tests/units/Core/CsvTest.php | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/app/Core/Csv.php b/app/Core/Csv.php index 28c1997b..e45af24c 100644 --- a/app/Core/Csv.php +++ b/app/Core/Csv.php @@ -93,7 +93,7 @@ class Csv { if (! empty($value)) { $value = trim(strtolower($value)); - return $value === '1' || $value{0} === 't' ? 1 : 0; + return $value === '1' || $value{0} === 't' || $value{0} === 'y' ? 1 : 0; } return 0; diff --git a/tests/units/Core/CsvTest.php b/tests/units/Core/CsvTest.php index 7276de7f..da0be4a3 100644 --- a/tests/units/Core/CsvTest.php +++ b/tests/units/Core/CsvTest.php @@ -14,6 +14,10 @@ class CsvTest extends Base $this->assertEquals(1, Csv::getBooleanValue('TRUE')); $this->assertEquals(1, Csv::getBooleanValue('true')); $this->assertEquals(1, Csv::getBooleanValue('T')); + $this->assertEquals(1, Csv::getBooleanValue('Y')); + $this->assertEquals(1, Csv::getBooleanValue('y')); + $this->assertEquals(1, Csv::getBooleanValue('yes')); + $this->assertEquals(1, Csv::getBooleanValue('Yes')); $this->assertEquals(0, Csv::getBooleanValue('0')); $this->assertEquals(0, Csv::getBooleanValue('123')); |