Files
saasshop/tests/Feature/AdminDashboardSubscriptionExpiryMiniBarsShouldRenderTest.php

41 lines
1.3 KiB
PHP

<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminDashboardSubscriptionExpiryMiniBarsShouldRenderTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_dashboard_should_render_subscription_expiry_mini_bars(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('data-role="dashboard-sub-expiry-bars"', $html);
$this->assertStringContainsString('data-role="dashboard-sub-expiring-7d-bar"', $html);
$this->assertStringContainsString('data-role="dashboard-sub-expired-bar"', $html);
$css = (string) file_get_contents(public_path('css/admin-components.css'));
$this->assertStringContainsString('.adm-mini-bar-row{', $css);
$this->assertStringContainsString('.adm-mini-bar-label{', $css);
$this->assertStringContainsString('.adm-mini-bar-value{', $css);
}
}