半角スペースを含むタグは受け付けない
This commit is contained in:
parent
54b6ff2282
commit
3a2d0e67aa
@ -178,6 +178,9 @@ class CheckinCsvImporter
|
||||
if (strpos($tag, "\n") !== false) {
|
||||
throw new CsvImportException("{$line} 行 : {$column}に改行を含めることはできません。");
|
||||
}
|
||||
if (strpos($tag, ' ') !== false) {
|
||||
throw new CsvImportException("{$line} 行 : {$column}にスペースを含めることはできません。");
|
||||
}
|
||||
|
||||
$tags[] = Tag::firstOrCreate(['name' => $tag]);
|
||||
if (count($tags) >= 32) {
|
||||
|
@ -240,6 +240,16 @@ class CheckinCsvImporterTest extends TestCase
|
||||
$importer->execute();
|
||||
}
|
||||
|
||||
public function testTagCantAcceptWhitespaceUTF8()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
$this->expectException(CsvImportException::class);
|
||||
$this->expectExceptionMessage('2 行 : タグ1にスペースを含めることはできません。');
|
||||
|
||||
$importer = new CheckinCsvImporter($user, __DIR__ . '/../../fixture/Csv/tag-whitespace.utf8.csv');
|
||||
$importer->execute();
|
||||
}
|
||||
|
||||
public function testTagCanAccept32ColumnsUTF8()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
|
2
tests/fixture/Csv/tag-whitespace.utf8.csv
vendored
Normal file
2
tests/fixture/Csv/tag-whitespace.utf8.csv
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
日時,タグ1
|
||||
2020/01/23 06:01,"空白を含む タグ"
|
|
Loading…
Reference in New Issue
Block a user