This repository was archived by the owner on Nov 30, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,14 @@ trait BillingControllerTrait
2121 /**
2222 * Redirects to billing screen for Shopify.
2323 *
24- * @param \OhMyBrew\ShopifyApp\Models\Plan|null $plan The plan.
24+ * @param \OhMyBrew\ShopifyApp\Models\Plan $plan The plan.
2525 *
2626 * @return \Illuminate\View\View
2727 */
28- public function index (Plan $ plan = null )
28+ public function index (Plan $ plan )
2929 {
3030 // If the plan is null, get a plan
31- if (is_null ($ plan )) {
31+ if (is_null ($ plan ) || ( $ plan && ! $ plan -> exists ) ) {
3232 $ plan = Plan::where ('on_install ' , true )->first ();
3333 }
3434
Original file line number Diff line number Diff line change 11<?php
22
3- use OhMyBrew \ShopifyApp \Models \Plan ;
4-
53/*
64|--------------------------------------------------------------------------
75| Web Routes
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class BillingControllerTest extends TestCase
1616 public function setUp ()
1717 {
1818 parent ::setUp ();
19-
19+ ; $ this -> withoutExceptionHandling ();
2020 // Stub in our API class
2121 Config::set ('shopify-app.api_class ' , new ApiStub ());
2222
@@ -36,6 +36,9 @@ public function testSendsShopToBillingScreen()
3636 $ shop = factory (Shop::class)->create ();
3737 Session::put ('shopify_domain ' , $ shop ->shopify_domain );
3838
39+ // Create a on-install plan
40+ factory (Plan::class)->states ('type_recurring ' , 'installable ' )->create ();
41+
3942 // Run the call
4043 $ response = $ this ->get ('/billing ' );
4144 $ response ->assertViewHas (
You can’t perform that action at this time.
0 commit comments