mardi 4 avril 2017

Test case removing original file while uploading a file through test case

This is my test case

public function testSelfieFileUpload()
{
    $path = public_path().'/uploads/sample1.jpg';
    $name = 'sample1.jpg';
    $file = new UploadedFile($path, $name, 'image/png', filesize($path), null, true);
    $response = $this->post($this->endpoint, ['file' => $file], $this->setHeaders());
    $response->assertStatus(200)
        ->assertJsonFragment(array("status" => "success"));
}

But the problem is that it is deleting the original file from the folder i.e sample1.jpg

Help me out. Am i missing something here? Although the test case is running fine.

Aucun commentaire:

Enregistrer un commentaire