mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 09:51:37 +00:00
60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\ServerLog;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class LogsTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_see_logs()
|
|
{
|
|
$this->actingAs($this->user);
|
|
|
|
/** @var ServerLog $log */
|
|
$log = ServerLog::factory()->create([
|
|
'server_id' => $this->server->id,
|
|
]);
|
|
|
|
$this->get(route('servers.logs', $this->server))
|
|
->assertSuccessful()
|
|
->assertSeeText($log->type);
|
|
}
|
|
|
|
public function test_see_logs_remote()
|
|
{
|
|
$this->actingAs($this->user);
|
|
|
|
/** @var ServerLog $log */
|
|
$log = ServerLog::factory()->create([
|
|
'server_id' => $this->server->id,
|
|
'is_remote' => true,
|
|
'type' => 'remote',
|
|
'name' => 'see-remote-log',
|
|
]);
|
|
|
|
$this->get(route('servers.logs.remote', $this->server))
|
|
->assertSuccessful()
|
|
->assertSeeText('see-remote-log');
|
|
}
|
|
|
|
public function test_create_remote_log()
|
|
{
|
|
$this->actingAs($this->user);
|
|
|
|
$this->post(route('servers.logs.remote.store', [
|
|
'server' => $this->server->id,
|
|
]), [
|
|
'path' => 'test-path',
|
|
])->assertOk();
|
|
|
|
$this->assertDatabaseHas('server_logs', [
|
|
'is_remote' => true,
|
|
'name' => 'test-path',
|
|
]);
|
|
}
|
|
}
|