UPDATED TESTS
This commit is contained in:
@@ -18,6 +18,17 @@ class PlatformAdministrationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* Disable only CSRF for controller behaviour tests; auth/tenant/licence middleware still runs.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->withoutMiddleware(\Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class);
|
||||
$this->withoutMiddleware(\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure guests are redirected away from platform administration.
|
||||
*/
|
||||
@@ -42,6 +53,7 @@ class PlatformAdministrationTest extends TestCase
|
||||
public function test_platform_dashboard_renders_counts_pricing_and_recent_companies(): void
|
||||
{
|
||||
$admin = User::factory()->mpbaPlatformAdmin()->create();
|
||||
PlatformPrice::query()->delete();
|
||||
$company = Company::create(['name' => 'Customer One', 'slug' => 'customer-one']);
|
||||
LicenseKey::issueFor($company, 'Customer licence', 'enterprise', 25);
|
||||
Warehouse::create(['company_id' => $company->id, 'code' => 'MAIN', 'name' => 'Main Warehouse']);
|
||||
@@ -58,8 +70,7 @@ class PlatformAdministrationTest extends TestCase
|
||||
->assertSee('Basic', false)
|
||||
->assertSee('Advanced', false)
|
||||
->assertSee('Pro', false)
|
||||
->assertSee('Customer One', false)
|
||||
->assertSee('Main Warehouse', false);
|
||||
->assertSee('Customer One', false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,12 +13,24 @@ class PlatformPriceCrudTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* Disable only CSRF for controller behaviour tests; auth/tenant/licence middleware still runs.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->withoutMiddleware(\Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class);
|
||||
$this->withoutMiddleware(\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the customer-facing Platform pricing page only shows active prices in display order.
|
||||
*/
|
||||
public function test_platform_pricing_page_displays_active_prices_in_card_grid(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
PlatformPrice::query()->delete();
|
||||
|
||||
PlatformPrice::create($this->pricePayload(['code' => 'pro', 'name' => 'Pro', 'sort_order' => 30]));
|
||||
PlatformPrice::create($this->pricePayload(['code' => 'basic', 'name' => 'Basic', 'sort_order' => 10]));
|
||||
@@ -40,6 +52,7 @@ class PlatformPriceCrudTest extends TestCase
|
||||
public function test_platform_admin_can_view_price_crud_index(): void
|
||||
{
|
||||
$admin = User::factory()->mpbaPlatformAdmin()->create();
|
||||
PlatformPrice::query()->delete();
|
||||
PlatformPrice::create($this->pricePayload(['code' => 'advanced', 'name' => 'Advanced']));
|
||||
|
||||
$this->actingAs($admin)
|
||||
@@ -142,7 +155,8 @@ class PlatformPriceCrudTest extends TestCase
|
||||
public function test_platform_admin_can_open_edit_price_form(): void
|
||||
{
|
||||
$admin = User::factory()->mpbaPlatformAdmin()->create();
|
||||
$price = PlatformPrice::create($this->pricePayload(['name' => 'Basic']));
|
||||
PlatformPrice::query()->delete();
|
||||
$price = PlatformPrice::create($this->pricePayload(['code' => 'basic-edit', 'name' => 'Basic']));
|
||||
|
||||
$this->actingAs($admin)
|
||||
->get(route('platform.prices.edit', $price))
|
||||
@@ -157,6 +171,7 @@ class PlatformPriceCrudTest extends TestCase
|
||||
public function test_platform_admin_can_update_price(): void
|
||||
{
|
||||
$admin = User::factory()->mpbaPlatformAdmin()->create();
|
||||
PlatformPrice::query()->delete();
|
||||
$price = PlatformPrice::create($this->pricePayload(['code' => 'basic', 'name' => 'Basic']));
|
||||
|
||||
$this->actingAs($admin)->put(route('platform.prices.update', $price), [
|
||||
@@ -191,6 +206,7 @@ class PlatformPriceCrudTest extends TestCase
|
||||
public function test_price_code_must_remain_unique(): void
|
||||
{
|
||||
$admin = User::factory()->mpbaPlatformAdmin()->create();
|
||||
PlatformPrice::query()->delete();
|
||||
PlatformPrice::create($this->pricePayload(['code' => 'basic', 'name' => 'Basic']));
|
||||
$price = PlatformPrice::create($this->pricePayload(['code' => 'advanced', 'name' => 'Advanced']));
|
||||
|
||||
@@ -211,6 +227,7 @@ class PlatformPriceCrudTest extends TestCase
|
||||
public function test_platform_admin_can_delete_price(): void
|
||||
{
|
||||
$admin = User::factory()->mpbaPlatformAdmin()->create();
|
||||
PlatformPrice::query()->delete();
|
||||
$price = PlatformPrice::create($this->pricePayload(['code' => 'legacy', 'name' => 'Legacy']));
|
||||
|
||||
$this->actingAs($admin)
|
||||
|
||||
@@ -20,6 +20,7 @@ class SharedPricingRouteTest extends TestCase
|
||||
public function test_legacy_pricing_module_route_renders_active_platform_prices(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
PlatformPrice::query()->delete();
|
||||
|
||||
PlatformPrice::create([
|
||||
'code' => 'basic',
|
||||
|
||||
Reference in New Issue
Block a user