add test
This commit is contained in:
parent
3015f82611
commit
27e9a86be8
@ -277,6 +277,48 @@ class CheckinCsvImporterTest extends TestCase
|
||||
$this->assertEquals(Ejaculation::SOURCE_CSV, $ejaculation->source);
|
||||
}
|
||||
|
||||
public function testIsPrivateUTF8()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
|
||||
$importer = new CheckinCsvImporter($user, __DIR__ . '/../../fixture/Csv/private.utf8.csv');
|
||||
$importer->execute();
|
||||
|
||||
$ejaculations = $user->ejaculations()->orderBy('ejaculated_date')->get();
|
||||
|
||||
$this->assertSame(9, $ejaculations->count());
|
||||
$this->assertTrue($ejaculations[0]->is_private);
|
||||
$this->assertTrue($ejaculations[1]->is_private);
|
||||
$this->assertTrue($ejaculations[2]->is_private);
|
||||
$this->assertTrue($ejaculations[3]->is_private);
|
||||
$this->assertFalse($ejaculations[4]->is_private);
|
||||
$this->assertFalse($ejaculations[5]->is_private);
|
||||
$this->assertFalse($ejaculations[6]->is_private);
|
||||
$this->assertFalse($ejaculations[7]->is_private);
|
||||
$this->assertFalse($ejaculations[8]->is_private);
|
||||
}
|
||||
|
||||
public function testIsTooSensitiveUTF8()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
|
||||
$importer = new CheckinCsvImporter($user, __DIR__ . '/../../fixture/Csv/too-sensitive.utf8.csv');
|
||||
$importer->execute();
|
||||
|
||||
$ejaculations = $user->ejaculations()->orderBy('ejaculated_date')->get();
|
||||
|
||||
$this->assertSame(9, $ejaculations->count());
|
||||
$this->assertTrue($ejaculations[0]->is_too_sensitive);
|
||||
$this->assertTrue($ejaculations[1]->is_too_sensitive);
|
||||
$this->assertTrue($ejaculations[2]->is_too_sensitive);
|
||||
$this->assertTrue($ejaculations[3]->is_too_sensitive);
|
||||
$this->assertFalse($ejaculations[4]->is_too_sensitive);
|
||||
$this->assertFalse($ejaculations[5]->is_too_sensitive);
|
||||
$this->assertFalse($ejaculations[6]->is_too_sensitive);
|
||||
$this->assertFalse($ejaculations[7]->is_too_sensitive);
|
||||
$this->assertFalse($ejaculations[8]->is_too_sensitive);
|
||||
}
|
||||
|
||||
public function testDontThrowUniqueKeyViolation()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
|
10
tests/fixture/Csv/private.utf8.csv
vendored
Normal file
10
tests/fixture/Csv/private.utf8.csv
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
日時,非公開
|
||||
2020/01/23 06:01:00,true
|
||||
2020/01/23 06:02:00,TRUE
|
||||
2020/01/23 06:03:00,True
|
||||
2020/01/23 06:04:00,1
|
||||
2020/01/23 07:01:00,false
|
||||
2020/01/23 07:02:00,FALSE
|
||||
2020/01/23 07:03:00,False
|
||||
2020/01/23 07:04:00,0
|
||||
2020/01/23 07:05:00,
|
|
10
tests/fixture/Csv/too-sensitive.utf8.csv
vendored
Normal file
10
tests/fixture/Csv/too-sensitive.utf8.csv
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
日時,センシティブ
|
||||
2020/01/23 06:01:00,true
|
||||
2020/01/23 06:02:00,TRUE
|
||||
2020/01/23 06:03:00,True
|
||||
2020/01/23 06:04:00,1
|
||||
2020/01/23 07:01:00,false
|
||||
2020/01/23 07:02:00,FALSE
|
||||
2020/01/23 07:03:00,False
|
||||
2020/01/23 07:04:00,0
|
||||
2020/01/23 07:05:00,
|
|
Loading…
Reference in New Issue
Block a user