From 333fb1e45f16a3c3fbaa796478b6e0a52f10ecf7 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Tue, 14 May 2024 18:21:05 +0300 Subject: [PATCH] update --- web/tests/Unit/AutoInstallPanelTest.php | 34 ++++++++++++++++++- .../Unit/HostingSubscriptionCreateTest.php | 27 --------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/web/tests/Unit/AutoInstallPanelTest.php b/web/tests/Unit/AutoInstallPanelTest.php index 58eff7d..ba8c0ae 100644 --- a/web/tests/Unit/AutoInstallPanelTest.php +++ b/web/tests/Unit/AutoInstallPanelTest.php @@ -2,10 +2,42 @@ namespace tests\Unit; -class AutoInstallPanelTest extends ActionTestCase +use App\Installers\Server\Applications\PHPInstaller; +use App\SupportedApplicationTypes; +use Illuminate\Support\Str; +use Tests\TestCase; + +class AutoInstallPanelTest extends TestCase { public function testInstall() { + $this->assertTrue(Str::contains(php_uname(),'Ubuntu')); +// + // Make Apache+PHP Application Server with all supported php versions and modules + $installLogFilePath = storage_path('install-apache-php-log-unit-test.txt'); + $phpInstaller = new PHPInstaller(); + $phpInstaller->setPHPVersions(array_keys(SupportedApplicationTypes::getPHPVersions())); + $phpInstaller->setPHPModules(array_keys(SupportedApplicationTypes::getPHPModules())); + $phpInstaller->setLogFilePath($installLogFilePath); + $phpInstaller->install(); + + $installationSuccess = false; + for ($i = 1; $i <= 100; $i++) { + $logContent = file_get_contents($installLogFilePath); + if (str_contains($logContent, 'All packages installed successfully!')) { + $installationSuccess = true; + break; + } + sleep(3); + } + + if (!$installationSuccess) { + $logContent = file_get_contents($installLogFilePath); + $this->fail('Apache+PHP installation failed. Log: '.$logContent); + } + + $this->assertTrue($installationSuccess, 'Apache+PHP installation failed'); + } } diff --git a/web/tests/Unit/HostingSubscriptionCreateTest.php b/web/tests/Unit/HostingSubscriptionCreateTest.php index 0dd22f8..0ab7e94 100644 --- a/web/tests/Unit/HostingSubscriptionCreateTest.php +++ b/web/tests/Unit/HostingSubscriptionCreateTest.php @@ -41,33 +41,6 @@ class HostingSubscriptionCreateTest extends ActionTestCase function test_create() { - $this->assertTrue(Str::contains(php_uname(),'Ubuntu')); -// - // Make Apache+PHP Application Server with all supported php versions and modules - $installLogFilePath = storage_path('install-apache-php-log-unit-test.txt'); - $phpInstaller = new PHPInstaller(); - $phpInstaller->setPHPVersions(array_keys(SupportedApplicationTypes::getPHPVersions())); - $phpInstaller->setPHPModules(array_keys(SupportedApplicationTypes::getPHPModules())); - $phpInstaller->setLogFilePath($installLogFilePath); - $phpInstaller->install(); - - $installationSuccess = false; - for ($i = 1; $i <= 100; $i++) { - $logContent = file_get_contents($installLogFilePath); - if (str_contains($logContent, 'All packages installed successfully!')) { - $installationSuccess = true; - break; - } - sleep(3); - } - - if (!$installationSuccess) { - $logContent = file_get_contents($installLogFilePath); - $this->fail('Apache+PHP installation failed. Log: '.$logContent); - } - - $this->assertTrue($installationSuccess, 'Apache+PHP installation failed'); - // Make unauthorized call $callUnauthorizedResponse = $this->callRouteAction('api.hosting-subscriptions.store')->json(); $this->assertArrayHasKey('error', $callUnauthorizedResponse);