You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
json2db/tests/Feature/Upload/ConvertJsonTest.php

40 lines
921 B

<?php
namespace Tests\Feature\Upload;
use App\Jobs\ChunkFile;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Http\Testing\File;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class ConvertJsonTest extends TestCase
{
/**
* upload json file.
*
* @return void
* @group convert
*/
public function test_example()
{
$content = file_get_contents(base_path('/tests/Storage/ConvertJsonTest.json'));
$file = File::createWithContent(
'test.json',
$content
);
Bus::fake();
Storage::fake();
$this->post('/api/v1/convert/json', [
'file' => $file
])
->assertSuccessful();
Storage::assertExists($file->name);
Bus::assertDispatched(ChunkFile::class, 1);
}
}