Skip to content

Commit b36df3b

Browse files
authored
Merge pull request #1 from laravelcm/plan-test
Plan test
2 parents cd86538 + 69a8d63 commit b36df3b

File tree

15 files changed

+233
-15
lines changed

15 files changed

+233
-15
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: mckenziearts

.github/workflows/phpstan.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: PHPStan
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
phpstan:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
php: [8.1, 8.2]
14+
laravel: [9.*, 10.*]
15+
dependency-version: [prefer-stable]
16+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Cache dependencies
20+
uses: actions/cache@v2
21+
with:
22+
path: ~/.composer/cache/files
23+
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
29+
coverage: none
30+
- name: Install dependencies
31+
run: composer install --prefer-dist --no-interaction
32+
- name: Run PHPStan
33+
run: composer stan

.github/workflows/pint.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Check & fix styling
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v3
12+
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: 8.2
17+
extensions: json, dom, curl, libxml, mbstring
18+
coverage: none
19+
20+
- name: Install Pint
21+
run: composer global require laravel/pint
22+
23+
- name: Run Pint
24+
run: pint
25+
26+
- name: Commit linted files
27+
uses: stefanzweifel/git-auto-commit-action@v4
28+
with:
29+
commit_message: Fix code styling

.github/workflows/tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
tests:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v3
12+
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: 8.2
17+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
18+
tools: composer:v2
19+
coverage: none
20+
21+
- name: Install Composer dependencies
22+
run: composer install --prefer-dist --no-interaction
23+
24+
- name: Execute tests
25+
run: composer pest

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"email": "support@laravel.cm",
1818
"issues": "https://github.com/laravelcm/laravel-subscriptions/issues",
1919
"source": "https://github.com/laravelcm/laravel-subscriptions",
20-
"docs": "https://github.com/laravelcm/laravel-subscriptions/blob/master/README.md"
20+
"docs": "https://github.com/laravelcm/laravel-subscriptions/blob/main/README.md"
2121
},
2222
"authors": [
2323
{

database/migrations/2020_01_01_000001_create_plans_table.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ public function up(): void
1212
Schema::create(config('laravel-subscriptions.tables.plans'), function (Blueprint $table): void {
1313
$table->id();
1414

15-
$table->string('slug')->unique();
1615
$table->json('name');
16+
$table->string('slug')->unique();
1717
$table->json('description')->nullable();
1818
$table->boolean('is_active')->default(true);
1919
$table->decimal('price')->default('0.00');
2020
$table->decimal('signup_fee')->default('0.00');
2121
$table->string('currency', 3);
22-
$table->smallInteger('trial_period')->unsigned()->default(0);
22+
$table->unsignedSmallInteger('trial_period')->default(0);
2323
$table->string('trial_interval')->default('day');
24-
$table->smallInteger('invoice_period')->unsigned()->default(0);
24+
$table->unsignedSmallInteger('invoice_period')->default(0);
2525
$table->string('invoice_interval')->default('month');
26-
$table->smallInteger('grace_period')->unsigned()->default(0);
26+
$table->unsignedSmallInteger('grace_period')->default(0);
2727
$table->string('grace_interval')->default('day');
28-
$table->tinyInteger('prorate_day')->unsigned()->nullable();
29-
$table->tinyInteger('prorate_period')->unsigned()->nullable();
30-
$table->tinyInteger('prorate_extend_due')->unsigned()->nullable();
31-
$table->smallInteger('active_subscribers_limit')->unsigned()->nullable();
32-
$table->mediumInteger('sort_order')->unsigned()->default(0);
28+
$table->unsignedTinyInteger('prorate_day')->nullable();
29+
$table->unsignedTinyInteger('prorate_period')->nullable();
30+
$table->unsignedTinyInteger('prorate_extend_due')->nullable();
31+
$table->unsignedSmallInteger('active_subscribers_limit')->nullable();
32+
$table->unsignedSmallInteger('sort_order')->default(0);
3333

3434
$table->timestamps();
3535
$table->softDeletes();

database/migrations/2020_01_01_000002_create_plan_features_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public function up(): void
1414
$table->id();
1515

1616
$table->foreignIdFor(Plan::class);
17-
$table->string('slug')->unique();
1817
$table->json('name');
18+
$table->string('slug')->unique();
1919
$table->json('description')->nullable();
2020
$table->string('value');
2121
$table->unsignedSmallInteger('resettable_period')->default(0);

database/migrations/2020_01_01_000003_create_plan_subscriptions_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public function up(): void
1515

1616
$table->morphs('subscriber');
1717
$table->foreignIdFor(Plan::class);
18-
$table->string('slug')->unique();
1918
$table->json('name');
19+
$table->string('slug')->unique();
2020
$table->json('description')->nullable();
2121
$table->string('timezone')->nullable();
2222

pint.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"declare_parentheses": true,
1313
"declare_strict_types": true,
1414
"explicit_string_variable": true,
15-
"final_class": true,
1615
"final_internal_class": false,
1716
"fully_qualified_strict_types": true,
1817
"global_namespace_import": {

src/Models/Plan.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* @property string $slug
2222
* @property array $name
2323
* @property array $description
24-
* @property bool$is_active
24+
* @property bool $is_active
2525
* @property float $price
2626
* @property float $signup_fee
2727
* @property string $currency
@@ -39,7 +39,7 @@
3939
* @property \Carbon\Carbon|null $created_at
4040
* @property \Carbon\Carbon|null $updated_at
4141
* @property \Carbon\Carbon|null $deleted_at
42-
* @property-read \Illuminate\Database\Eloquent\Collection|\Laravelcm\Subscriptions\Models\Feature[] $features
42+
* @property-read \Illuminate\Database\Eloquent\Collection|\Laravelcm\Subscriptions\Models\Feature[] $features
4343
* @property-read \Illuminate\Database\Eloquent\Collection|\Laravelcm\Subscriptions\Models\Subscription[] $subscriptions
4444
*
4545
* @method static \Illuminate\Database\Eloquent\Builder|\Laravelcm\Subscriptions\Models\Plan ordered($direction = 'asc')

0 commit comments

Comments
 (0)