diff --git a/tests/Feature/AdminTest.php b/tests/Feature/AdminTest.php index baf86730..7da4a717 100644 --- a/tests/Feature/AdminTest.php +++ b/tests/Feature/AdminTest.php @@ -442,6 +442,11 @@ class AdminTest extends TestCase { $this->setup->seed_default_pages(); + $admin = User::factory(User::class) + ->create(['role' => 'admin']); + + Sanctum::actingAs($admin); + collect(['terms-of-service', 'privacy-policy', 'cookie-policy']) ->each(function ($slug) { $this->getJson('/api/admin/pages') @@ -459,6 +464,11 @@ class AdminTest extends TestCase { $this->setup->seed_default_pages(); + $admin = User::factory(User::class) + ->create(['role' => 'admin']); + + Sanctum::actingAs($admin); + $this->getJson('/api/admin/pages/terms-of-service') ->assertStatus(200) ->assertJsonFragment([ @@ -473,6 +483,11 @@ class AdminTest extends TestCase { $this->setup->seed_default_pages(); + $admin = User::factory(User::class) + ->create(['role' => 'admin']); + + Sanctum::actingAs($admin); + $this->patchJson('/api/admin/pages/terms-of-service', [ 'name' => 'title', 'value' => 'New Title' @@ -490,6 +505,11 @@ class AdminTest extends TestCase { $this->setup->seed_default_settings('Extended'); + $admin = User::factory(User::class) + ->create(['role' => 'admin']); + + Sanctum::actingAs($admin); + $this->getJson('/api/admin/settings?column=section_features|section_feature_boxes') ->assertStatus(200) ->assertJsonFragment([ @@ -505,6 +525,11 @@ class AdminTest extends TestCase { $this->setup->seed_default_settings('Extended'); + $admin = User::factory(User::class) + ->create(['role' => 'admin']); + + Sanctum::actingAs($admin); + $this->patchJson('/api/admin/settings', [ 'name' => 'header_title', 'value' => 'New Header Title' @@ -532,6 +557,11 @@ class AdminTest extends TestCase $logo = UploadedFile::fake() ->image('fake-image.jpg'); + $admin = User::factory(User::class) + ->create(['role' => 'admin']); + + Sanctum::actingAs($admin); + $this->patchJson('/api/admin/settings', [ 'name' => 'app_logo', 'app_logo' => $logo @@ -551,6 +581,11 @@ class AdminTest extends TestCase */ public function it_flush_cache() { + $admin = User::factory(User::class) + ->create(['role' => 'admin']); + + Sanctum::actingAs($admin); + $this->getJson('/api/admin/settings/flush-cache') ->assertStatus(204); } @@ -560,6 +595,11 @@ class AdminTest extends TestCase */ public function it_set_stripe() { + $admin = User::factory(User::class) + ->create(['role' => 'admin']); + + Sanctum::actingAs($admin); + $this->postJson('/api/admin/settings/stripe', [ 'currency' => 'EUR', 'key' => '123456789', @@ -588,6 +628,11 @@ class AdminTest extends TestCase */ public function it_set_email() { + $admin = User::factory(User::class) + ->create(['role' => 'admin']); + + Sanctum::actingAs($admin); + $this->postJson('/api/admin/settings/email', [ 'driver' => 'smtp', 'host' => 'smtp.email.com', diff --git a/tests/Feature/SubscriptionTest.php b/tests/Feature/SubscriptionTest.php index 43de2dcf..58090095 100644 --- a/tests/Feature/SubscriptionTest.php +++ b/tests/Feature/SubscriptionTest.php @@ -61,7 +61,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_get_setup_intent() { @@ -82,7 +82,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_upgrade_plan() { @@ -109,7 +109,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_cancel_subscription() { @@ -135,7 +135,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_resume_subscription() { @@ -164,7 +164,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_get_user_subscription_details() { @@ -204,7 +204,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_get_user_invoices() { @@ -229,7 +229,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_get_user_subscription_from_admin() { @@ -274,7 +274,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_get_user_invoices_from_admin() { @@ -296,7 +296,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_store_stripe_plans_via_setup_wizard() { @@ -325,7 +325,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_get_all_plans_from_admin() { @@ -339,7 +339,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_get_single_plan_from_admin() { @@ -353,7 +353,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_create_single_plan_from_admin() { @@ -380,7 +380,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_delete_single_plan() { @@ -410,7 +410,7 @@ class SubscriptionTest extends TestCase } /** - * + * */ public function it_update_single_plan_from_admin() {