|
@@ -186,6 +186,28 @@ class ReclamationControllerTest extends TestCase
|
|
|
$this->assertCount(1, $reclamation->fresh()->photos_before);
|
|
$this->assertCount(1, $reclamation->fresh()->photos_before);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function test_upload_photo_before_preserves_unicode_and_quotes_filename(): void
|
|
|
|
|
+ {
|
|
|
|
|
+ Storage::fake('public');
|
|
|
|
|
+
|
|
|
|
|
+ $reclamation = Reclamation::factory()->create();
|
|
|
|
|
+ $filename = "Фото «до» 'левая' \"камера\".jpg";
|
|
|
|
|
+ $photo = UploadedFile::fake()->create($filename, 100, 'image/jpeg');
|
|
|
|
|
+
|
|
|
|
|
+ $response = $this->actingAs($this->managerUser)
|
|
|
|
|
+ ->post(route('reclamations.upload-photo-before', $reclamation), [
|
|
|
|
|
+ 'photo' => [$photo],
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ $response->assertRedirect();
|
|
|
|
|
+
|
|
|
|
|
+ $saved = $reclamation->fresh()->photos_before->first();
|
|
|
|
|
+ $this->assertNotNull($saved);
|
|
|
|
|
+ $this->assertEquals($filename, $saved->original_name);
|
|
|
|
|
+ $this->assertEquals('reclamations/' . $reclamation->id . '/photo_before/' . $filename, $saved->path);
|
|
|
|
|
+ Storage::disk('public')->assertExists($saved->path);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function test_can_delete_photo_before(): void
|
|
public function test_can_delete_photo_before(): void
|
|
|
{
|
|
{
|
|
|
Storage::fake('public');
|
|
Storage::fake('public');
|
|
@@ -254,6 +276,28 @@ class ReclamationControllerTest extends TestCase
|
|
|
$this->assertCount(1, $reclamation->fresh()->documents);
|
|
$this->assertCount(1, $reclamation->fresh()->documents);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function test_upload_document_preserves_unicode_and_quotes_filename(): void
|
|
|
|
|
+ {
|
|
|
|
|
+ Storage::fake('public');
|
|
|
|
|
+
|
|
|
|
|
+ $reclamation = Reclamation::factory()->create();
|
|
|
|
|
+ $filename = "Рекламация «док» 'версия' \"A\".pdf";
|
|
|
|
|
+ $document = UploadedFile::fake()->create($filename, 100, 'application/pdf');
|
|
|
|
|
+
|
|
|
|
|
+ $response = $this->actingAs($this->managerUser)
|
|
|
|
|
+ ->post(route('reclamations.upload-document', $reclamation), [
|
|
|
|
|
+ 'document' => [$document],
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ $response->assertRedirect();
|
|
|
|
|
+
|
|
|
|
|
+ $saved = $reclamation->fresh()->documents->first();
|
|
|
|
|
+ $this->assertNotNull($saved);
|
|
|
|
|
+ $this->assertEquals($filename, $saved->original_name);
|
|
|
|
|
+ $this->assertEquals('reclamations/' . $reclamation->id . '/document/' . $filename, $saved->path);
|
|
|
|
|
+ Storage::disk('public')->assertExists($saved->path);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function test_can_delete_document(): void
|
|
public function test_can_delete_document(): void
|
|
|
{
|
|
{
|
|
|
Storage::fake('public');
|
|
Storage::fake('public');
|
|
@@ -288,6 +332,28 @@ class ReclamationControllerTest extends TestCase
|
|
|
$this->assertCount(1, $reclamation->fresh()->acts);
|
|
$this->assertCount(1, $reclamation->fresh()->acts);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function test_upload_act_preserves_unicode_and_quotes_filename(): void
|
|
|
|
|
+ {
|
|
|
|
|
+ Storage::fake('public');
|
|
|
|
|
+
|
|
|
|
|
+ $reclamation = Reclamation::factory()->create();
|
|
|
|
|
+ $filename = "Акт «сервис» 'этап' \"01\".pdf";
|
|
|
|
|
+ $act = UploadedFile::fake()->create($filename, 100, 'application/pdf');
|
|
|
|
|
+
|
|
|
|
|
+ $response = $this->actingAs($this->managerUser)
|
|
|
|
|
+ ->post(route('reclamations.upload-act', $reclamation), [
|
|
|
|
|
+ 'acts' => [$act],
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ $response->assertRedirect();
|
|
|
|
|
+
|
|
|
|
|
+ $saved = $reclamation->fresh()->acts->first();
|
|
|
|
|
+ $this->assertNotNull($saved);
|
|
|
|
|
+ $this->assertEquals($filename, $saved->original_name);
|
|
|
|
|
+ $this->assertEquals('reclamations/' . $reclamation->id . '/act/' . $filename, $saved->path);
|
|
|
|
|
+ Storage::disk('public')->assertExists($saved->path);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function test_can_delete_act(): void
|
|
public function test_can_delete_act(): void
|
|
|
{
|
|
{
|
|
|
Storage::fake('public');
|
|
Storage::fake('public');
|