Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
fix: run integration tests with-all-dependencies (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
greatislander authored Oct 24, 2024
1 parent 6c23bf6 commit 862eeee
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: |
cd tests/integration
composer remove phpunit/phpunit --dev
composer require pestphp/pest:^2.0 pestphp/pest-plugin-laravel:^2.0 pestphp/pest-plugin-drift:^2.0 --dev
composer require pestphp/pest:^2.0 pestphp/pest-plugin-laravel:^2.0 pestphp/pest-plugin-drift:^2.0 --dev -W
vendor/bin/pest --init
vendor/bin/pest --drift
composer require livewire/livewire:^${{ matrix.livewire }}
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ parameters:
level: 5 # The level 9 is the highest level
ignoreErrors: []
excludePaths: []
checkMissingIterableValueType: false
scanFiles:
- vendor/chinleung/laravel-locales/src/helpers.php
scanDirectories:
Expand Down
5 changes: 0 additions & 5 deletions src/Models/Invitation.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ class Invitation extends Model
{
use HasFactory;

/**
* The attributes that are mass assignable.
*
* @var array<string>
*/
protected $fillable = [
'email',
'role',
Expand Down
8 changes: 6 additions & 2 deletions stubs/app/Http/Controllers/JoinController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Controllers;

use App\Models\Organization;
use App\Models\User;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
Expand All @@ -15,15 +16,16 @@ class JoinController extends Controller
*/
public function cancel(Request $request): RedirectResponse
{
/** @var Organization */
$joinable = $request->user()->joinable;

flash(__('You have cancelled your request to join :team.', ['team' => $joinable->getTranslation('name', 'en')]), 'success');

$request->user()->forceFill([
'joinable_type' => null,
'joinable_id' => null,
])->save();

flash(__('You have cancelled your request to join :team.', ['team' => $joinable->name]), 'success');

return redirect(\localized_route($joinable->getRoutePrefix().'.show', $joinable));
}

Expand All @@ -32,6 +34,7 @@ public function cancel(Request $request): RedirectResponse
*/
public function approve(Request $request, User $user): RedirectResponse
{
/** @var Organization */
$joinable = $user->joinable;

Gate::forUser($request->user())->authorize('update', $joinable);
Expand All @@ -53,6 +56,7 @@ public function approve(Request $request, User $user): RedirectResponse
*/
public function deny(Request $request, User $user): RedirectResponse
{
/** @var Organization */
$joinable = $user->joinable;

Gate::forUser($request->user())->authorize('update', $joinable);
Expand Down
15 changes: 0 additions & 15 deletions stubs/app/Models/Organization.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,16 @@ class Organization extends Model
use HasTranslations;
use Notifiable;

/**
* The attributes that are mass assignable.
*
* @var array<string>
*/
protected $fillable = [
'name',
'locality',
'region',
];

/**
* The relationships that should be deleted when an organization is deleted.
*
* @var array
*/
protected mixed $cascadeDeletes = [
'users',
];

/**
* The attributes that are translatable.
*
* @var array<string>
*/
public array $translatable = [
'name',
'slug',
Expand Down
10 changes: 0 additions & 10 deletions stubs/app/Models/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,12 @@ class Resource extends Model
use HasTranslatableSlug;
use HasTranslations;

/**
* The attributes that are mass assignable.
*
* @var array<string>
*/
protected $fillable = [
'title',
'user_id',
'summary',
];

/**
* The attributes that are translatable.
*
* @var array<string>
*/
public mixed $translatable = [
'title',
'slug',
Expand Down
8 changes: 0 additions & 8 deletions stubs/app/Models/ResourceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,12 @@ class ResourceCollection extends Model
use HasTranslatableSlug;
use HasTranslations;

/**
* The attributes that are mass assignable.
*
* @var array<string>
*/
protected $fillable = [
'title',
'user_id',
'description',
];

/**
* The attributes that are transterms
*/
public array $translatable = [
'title',
'slug',
Expand Down
25 changes: 4 additions & 21 deletions stubs/app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,24 @@ class User extends Authenticatable implements HasLocalePreference, MustVerifyEma
use Notifiable;
use TwoFactorAuthenticatable;

/**
* The attributes that are mass assignable.
*
* @var array<string>
*/
protected $fillable = [
'name',
'email',
'password',
'locale',
];

/**
* The attributes that should be hidden for arrays.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
'two_factor_recovery_codes',
'two_factor_secret',
];

/**
* The attributes that should be cast to native types.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];

/**
* The relationships that should be deleted when a user is deleted.
*
* @var array
*/
protected mixed $cascadeDeletes = [
'organizations',
];
Expand Down Expand Up @@ -123,7 +103,10 @@ public function joinable(): MorphTo
*/
public function hasRequestedToJoin(mixed $model)
{
return $this->joinable && $this->joinable->id === $model->id;
/** @var Organization|null */
$joinable = $this->joinable;

return ! is_null($joinable) && $joinable->id === $model->id;
}

/**
Expand Down
1 change: 0 additions & 1 deletion stubs/phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ parameters:
- vendor/chinleung/laravel-locales/src/helpers.php

ignoreErrors: []
checkMissingIterableValueType: false

0 comments on commit 862eeee

Please sign in to comment.