mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-24 16:40:27 +00:00
Update DockerTest.php
This commit is contained in:
parent
71ba6c2946
commit
aa48915b05
1 changed files with 31 additions and 2 deletions
|
@ -2,13 +2,42 @@
|
|||
|
||||
namespace tests\Unit;
|
||||
|
||||
use Tests\Feature\Api\ActionTestCase;
|
||||
use App\Models\User;
|
||||
use Livewire\Livewire;
|
||||
use Modules\Docker\Filament\Clusters\Docker\Pages\DockerCatalog;
|
||||
use Modules\Docker\PostInstall;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DockerTest extends ActionTestCase
|
||||
class DockerTest extends TestCase
|
||||
{
|
||||
public function testDocker()
|
||||
{
|
||||
$docker = new PostInstall();
|
||||
$docker->setLogFile('/tmp/phyrepanel-docker-install.log');
|
||||
$docker->run();
|
||||
|
||||
$dockerIsInstalled = false;
|
||||
for ($i = 0; $i < 50; $i++) {
|
||||
$logFile = file_get_contents('/tmp/phyrepanel-docker-install.log');
|
||||
if (strpos($logFile, 'Done!') !== false) {
|
||||
$dockerIsInstalled = true;
|
||||
break;
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
$this->assertTrue($dockerIsInstalled);
|
||||
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
$livewireCatalogIndex = Livewire::test(DockerCatalog::class)
|
||||
->set('keyword', 'nginx')
|
||||
->assertSee('nginx');
|
||||
|
||||
$viewData = $livewireCatalogIndex->viewData('dockerImages');
|
||||
$this->assertNotEmpty($viewData);
|
||||
|
||||
$livewireCatalogIndex->set('keyword', 'non-existing-image')
|
||||
->assertDontSee('non-existing-image');
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue