parent
1ab66350a7
commit
1158a040fa
@ -0,0 +1,35 @@ |
||||
<?php |
||||
|
||||
namespace App\Jobs; |
||||
|
||||
use Illuminate\Bus\Queueable; |
||||
use Illuminate\Contracts\Queue\ShouldBeUnique; |
||||
use Illuminate\Contracts\Queue\ShouldQueue; |
||||
use Illuminate\Foundation\Bus\Dispatchable; |
||||
use Illuminate\Queue\InteractsWithQueue; |
||||
use Illuminate\Queue\SerializesModels; |
||||
|
||||
class StoreChunk implements ShouldQueue |
||||
{ |
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
||||
|
||||
/** |
||||
* Create a new job instance. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function __construct() |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Execute the job. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function handle() |
||||
{ |
||||
// |
||||
} |
||||
} |
||||
@ -0,0 +1,38 @@ |
||||
<?php |
||||
|
||||
namespace Tests\Unit\Jobs; |
||||
|
||||
use App\Enums\FileFormatEnum; |
||||
use App\Jobs\ChunkFile; |
||||
use App\Jobs\StoreChunk; |
||||
use Illuminate\Support\Facades\Queue; |
||||
use Illuminate\Support\Facades\Storage; |
||||
use Illuminate\Support\Str; |
||||
use Tests\TestCase; |
||||
use Illuminate\Support\Facades\Bus; |
||||
|
||||
class ChunkFileTest extends TestCase |
||||
{ |
||||
/** |
||||
* A basic unit test example. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function test_chunk_json_file() |
||||
{ |
||||
Bus::fake(); |
||||
|
||||
$path = base_path('/tests/Storage/ConvertJsonTest.json'); |
||||
|
||||
Storage::shouldReceive('path')->andReturn($path); |
||||
Storage::shouldReceive('delete')->andReturnTrue(); |
||||
|
||||
(new ChunkFile( |
||||
Str::uuid(), |
||||
$path, |
||||
FileFormatEnum::JSON |
||||
))->handle(); |
||||
|
||||
Bus::assertDispatched(StoreChunk::class, 1); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue