UPDATED TESTS
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user