Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #55 from ohmybrew/analysis-z4VkMG
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
gnikyt authored Jul 20, 2018
2 parents f0d8891 + 6260000 commit 1b27b9d
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 62 deletions.
2 changes: 1 addition & 1 deletion src/ShopifyApp/Traits/BillingControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use Carbon\Carbon;
use OhMyBrew\ShopifyApp\Facades\ShopifyApp;
use OhMyBrew\ShopifyApp\Libraries\BillingPlan;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\Models\Charge;
use OhMyBrew\ShopifyApp\Models\Shop;

trait BillingControllerTrait
{
Expand Down
4 changes: 3 additions & 1 deletion src/ShopifyApp/resources/jobs/AppUninstalledJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

namespace App\Jobs;

class AppUninstalledJob extends \OhMyBrew\ShopifyApp\Jobs\AppUninstalledJob { }
class AppUninstalledJob extends \OhMyBrew\ShopifyApp\Jobs\AppUninstalledJob
{
}
4 changes: 2 additions & 2 deletions tests/Controllers/BillingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Carbon\Carbon;
use OhMyBrew\ShopifyApp\Controllers\BillingController;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\Models\Charge;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\Test\Stubs\ApiStub;
use OhMyBrew\ShopifyApp\Test\TestCase;
use ReflectionMethod;
Expand Down Expand Up @@ -122,7 +122,7 @@ public function testReturnsBasePlanDetailsChangedByCancelledCharge()
$controller = new BillingController();
$method = new ReflectionMethod(BillingController::class, 'planDetails');
$method->setAccessible(true);

// Based on default config
$this->assertEquals(
[
Expand Down
2 changes: 1 addition & 1 deletion tests/Models/ChargeModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function testCancelled()
{
$this->assertFalse(Charge::find(1)->isCancelled());
$this->assertFalse(Charge::find(4)->isCancelled());
$this->assertTrue(Charge::find(6)->isCancelled());;
$this->assertTrue(Charge::find(6)->isCancelled());
}

public function testRemainingTrialDaysFromCancel()
Expand Down
114 changes: 57 additions & 57 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@ protected function createShops()
// Paid shop, not grandfathered
[
'shopify_domain' => 'example.myshopify.com',
'shopify_token' => '1234',
'shopify_token' => '1234',
],

// Non-paid shop, grandfathered
[
'shopify_domain' => 'grandfathered.myshopify.com',
'shopify_token' => '1234',
'grandfathered' => true,
'shopify_token' => '1234',
'grandfathered' => true,
],

// New shop... non-paid, not grandfathered
[
'shopify_domain' => 'new-shop.myshopify.com',
'shopify_token' => '1234',
'shopify_token' => '1234',
],

// New shop... no token, not grandfathered
Expand Down Expand Up @@ -115,90 +115,90 @@ public function createCharges()
$charges = [
// Test = true, status = accepted, trial = 7, active trial = no
[
'charge_id' => 98298298,
'test' => true,
'name' => 'Test Plan',
'status' => 'accepted',
'type' => 1,
'price' => 15.00,
'trial_days' => 7,
'charge_id' => 98298298,
'test' => true,
'name' => 'Test Plan',
'status' => 'accepted',
'type' => 1,
'price' => 15.00,
'trial_days' => 7,
'trial_ends_on' => Carbon::createFromDate(2018, 6, 3, 'UTC')->addWeeks(1)->format('Y-m-d'),
'shop_id' => Shop::where('shopify_domain', 'example.myshopify.com')->first()->id,
'shop_id' => Shop::where('shopify_domain', 'example.myshopify.com')->first()->id,
],

// Test = false, status = active, trial = 7, active trial = yes
[
'charge_id' => 67298298,
'test' => false,
'name' => 'Base Plan',
'status' => 'active',
'type' => 1,
'price' => 25.00,
'trial_days' => 7,
'charge_id' => 67298298,
'test' => false,
'name' => 'Base Plan',
'status' => 'active',
'type' => 1,
'price' => 25.00,
'trial_days' => 7,
'trial_ends_on' => Carbon::today()->addDays(2)->format('Y-m-d'),
'shop_id' => Shop::where('shopify_domain', 'example.myshopify.com')->first()->id,
'shop_id' => Shop::where('shopify_domain', 'example.myshopify.com')->first()->id,
],

// Test = false, status = active, trial = 7, active trial = no
[
'charge_id' => 78378873,
'test' => false,
'name' => 'Base Plan Old',
'status' => 'active',
'type' => 1,
'price' => 25.00,
'trial_days' => 7,
'charge_id' => 78378873,
'test' => false,
'name' => 'Base Plan Old',
'status' => 'active',
'type' => 1,
'price' => 25.00,
'trial_days' => 7,
'trial_ends_on' => Carbon::today()->subWeeks(4)->format('Y-m-d'),
'shop_id' => Shop::where('shopify_domain', 'example.myshopify.com')->first()->id,
'shop_id' => Shop::where('shopify_domain', 'example.myshopify.com')->first()->id,
],

// Test = false, status = active, trial = 0
[
'charge_id' => 89389389,
'test' => false,
'name' => 'Base Plan Old Non-Trial',
'status' => 'active',
'type' => 1,
'price' => 25.00,
'charge_id' => 89389389,
'test' => false,
'name' => 'Base Plan Old Non-Trial',
'status' => 'active',
'type' => 1,
'price' => 25.00,
'trial_days' => 0,
'shop_id' => Shop::where('shopify_domain', 'example.myshopify.com')->first()->id,
'shop_id' => Shop::where('shopify_domain', 'example.myshopify.com')->first()->id,
],

// Test = false, status = declined, trial = 7, active trial = true
[
'charge_id' => 78378378378,
'test' => false,
'name' => 'Base Plan Declined',
'status' => 'declined',
'type' => 1,
'price' => 25.00,
'shop_id' => Shop::where('shopify_domain', 'no-token-shop.myshopify.com')->first()->id,
'test' => false,
'name' => 'Base Plan Declined',
'status' => 'declined',
'type' => 1,
'price' => 25.00,
'shop_id' => Shop::where('shopify_domain', 'no-token-shop.myshopify.com')->first()->id,
],

// Test = false, status = cancelled
[
'charge_id' => 783873873,
'test' => false,
'name' => 'Base Plan Cancelled',
'status' => 'active',
'type' => 1,
'price' => 25.00,
'shop_id' => Shop::where('shopify_domain', 'example.myshopify.com')->first()->id,
'charge_id' => 783873873,
'test' => false,
'name' => 'Base Plan Cancelled',
'status' => 'active',
'type' => 1,
'price' => 25.00,
'shop_id' => Shop::where('shopify_domain', 'example.myshopify.com')->first()->id,
'cancelled_on' => Carbon::today()->format('Y-m-d'),
],

// Test = false, status = cancelled, trial = 7
[
'charge_id' => 928736721,
'test' => false,
'name' => 'Base Plan Cancelled',
'status' => 'cancelled',
'type' => 1,
'price' => 25.00,
'trial_days' => 7,
'charge_id' => 928736721,
'test' => false,
'name' => 'Base Plan Cancelled',
'status' => 'cancelled',
'type' => 1,
'price' => 25.00,
'trial_days' => 7,
'trial_ends_on' => Carbon::today()->addWeeks(1)->format('Y-m-d'),
'cancelled_on' => Carbon::today()->addDays(2)->format('Y-m-d'),
'shop_id' => Shop::withTrashed()->where('shopify_domain', 'trashed-shop.myshopify.com')->first()->id,
'cancelled_on' => Carbon::today()->addDays(2)->format('Y-m-d'),
'shop_id' => Shop::withTrashed()->where('shopify_domain', 'trashed-shop.myshopify.com')->first()->id,
],
];

Expand Down

0 comments on commit 1b27b9d

Please # to comment.