- Add login wallpaper upload, preview, and deletion in Hospital Profile settings - Redesign login page with right-docked form and left hospital branding hero - Implement clean blank neutral fallback when no wallpaper is configured - Add automated unit tests for wallpaper rendering and fallback behavior
72 lines
2.9 KiB
PHP
72 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use CodeIgniter\Test\CIUnitTestCase;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class HospitalProfileWallpaperTest extends CIUnitTestCase
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
helper('common');
|
|
helper('setting');
|
|
|
|
$db = \Config\Database::connect();
|
|
$db->query("CREATE TABLE IF NOT EXISTS db_hospital_setting (id INTEGER PRIMARY KEY AUTOINCREMENT, s_name TEXT, s_value TEXT)");
|
|
$db->query("CREATE TABLE IF NOT EXISTS db_settings (id INTEGER PRIMARY KEY AUTOINCREMENT, class TEXT, key TEXT, value TEXT, type TEXT, context TEXT, created_at TEXT, updated_at TEXT)");
|
|
}
|
|
|
|
public function testHospitalProfileViewContainsWallpaperControls(): void
|
|
{
|
|
$viewData = [
|
|
'hospital_name' => 'City Hospital',
|
|
'hospital_address_1' => '123 Medical Road',
|
|
'hospital_address_2' => 'Civil Lines',
|
|
'hospital_phone' => '9876543210',
|
|
'hospital_email' => 'admin@cityhospital.in',
|
|
'hospital_hfr_id' => 'IN0510000871',
|
|
'footer_version' => '2026.01',
|
|
'hospital_logo' => 'test_logo.png',
|
|
'hospital_logo_url' => 'http://localhost:8080/assets/images/test_logo.png',
|
|
'hospital_wallpaper' => 'test_wallpaper.jpg',
|
|
'hospital_wallpaper_url' => 'http://localhost:8080/assets/images/test_wallpaper.jpg',
|
|
'pharmacy_name' => 'City Hospital Pharmacy',
|
|
'pharmacy_address' => 'Ground Floor',
|
|
'pharmacy_phone' => '9876543211',
|
|
'pharmacy_gst' => '05ABIPR7922F1ZJ',
|
|
'pharmacy_logo' => '',
|
|
'pharmacy_logo_url' => '',
|
|
'sidebar_auto_hide_seconds' => '7',
|
|
'allow_image_preupload_edit' => '0',
|
|
];
|
|
|
|
$html = view('Setting/Admin/hospital_profile', $viewData);
|
|
|
|
$this->assertStringContainsString('id="hospital_wallpaper"', $html);
|
|
$this->assertStringContainsString('id="hospital_wallpaper_preview"', $html);
|
|
$this->assertStringContainsString('id="btn_hospital_wallpaper_delete"', $html);
|
|
$this->assertStringContainsString('test_wallpaper.jpg', $html);
|
|
$this->assertStringContainsString('renderWallpaper', $html);
|
|
}
|
|
|
|
public function testLoginViewRendersWithRightSideLayoutAndKeyElements(): void
|
|
{
|
|
$html = view('auth/login');
|
|
|
|
// Check right side layout container
|
|
$this->assertStringContainsString('login-page-wrapper', $html);
|
|
$this->assertStringContainsString('login-form-section', $html);
|
|
$this->assertStringContainsString('login-hero-section', $html);
|
|
|
|
// Verify key login elements exist in the right panel
|
|
$this->assertStringContainsString('floatingUsernameInput', $html);
|
|
$this->assertStringContainsString('floatingPasswordInput', $html);
|
|
$this->assertStringContainsString('captchaInput', $html);
|
|
$this->assertStringContainsString('loginMobileAppsModal', $html);
|
|
}
|
|
}
|