mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
fix notification chanels and more tests (#108)
* fix notification chanels and more tests * fix code style
This commit is contained in:
69
tests/Feature/QueuesTest.php
Normal file
69
tests/Feature/QueuesTest.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\QueueStatus;
|
||||
use App\Http\Livewire\Queues\CreateQueue;
|
||||
use App\Http\Livewire\Queues\QueuesList;
|
||||
use App\Models\Queue;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
class QueuesTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_see_queues()
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$queue = Queue::factory()->create([
|
||||
'server_id' => $this->server->id,
|
||||
'site_id' => $this->site->id,
|
||||
]);
|
||||
|
||||
Livewire::test(QueuesList::class, ['site' => $this->site])
|
||||
->assertSeeText($queue->command);
|
||||
}
|
||||
|
||||
public function test_delete_queue()
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$queue = Queue::factory()->create([
|
||||
'server_id' => $this->server->id,
|
||||
'site_id' => $this->site->id,
|
||||
]);
|
||||
|
||||
Livewire::test(QueuesList::class, ['site' => $this->site])
|
||||
->set('deleteId', $queue->id)
|
||||
->call('delete')
|
||||
->assertDispatched('confirmed');
|
||||
}
|
||||
|
||||
public function test_create_queue()
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
Livewire::test(CreateQueue::class, ['site' => $this->site])
|
||||
->set('command', 'php artisan queue:work')
|
||||
->set('user', 'vito')
|
||||
->set('auto_start', 1)
|
||||
->set('auto_restart', 1)
|
||||
->set('numprocs', 1)
|
||||
->call('create')
|
||||
->assertDispatched('created');
|
||||
|
||||
$this->assertDatabaseHas('queues', [
|
||||
'server_id' => $this->server->id,
|
||||
'site_id' => $this->site->id,
|
||||
'command' => 'php artisan queue:work',
|
||||
'user' => 'vito',
|
||||
'auto_start' => 1,
|
||||
'auto_restart' => 1,
|
||||
'numprocs' => 1,
|
||||
'status' => QueueStatus::CREATING,
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user