diff --git a/app/Http/Controllers/CalendarController.php b/app/Http/Controllers/CalendarController.php index ec14f35..9195e23 100644 --- a/app/Http/Controllers/CalendarController.php +++ b/app/Http/Controllers/CalendarController.php @@ -11,19 +11,19 @@ use Mcamara\LaravelLocalization\Facades\LaravelLocalization; class CalendarController extends Controller { - public $weekStartsAt; + public int $weekStartsAt; - public $weekEndsAt; + public int $weekEndsAt; - public $startsAt; + public Carbon $startsAt; - public $endsAt; + public Carbon $endsAt; - public $gridStartsAt; + public Carbon $gridStartsAt; - public $gridEndsAt; + public Carbon $gridEndsAt; - public function __construct($initialYear = null, $initialMonth = null, $weekStartsAt = null) + public function __construct(int $initialYear = null, int $initialMonth = null, int $weekStartsAt = null) { $this->weekStartsAt = $weekStartsAt ?? Carbon::MONDAY; $this->weekEndsAt = $this->weekStartsAt === Carbon::MONDAY @@ -38,7 +38,7 @@ class CalendarController extends Controller $this->calculateGridStartsEnds(); } - public function calculateGridStartsEnds() + public function calculateGridStartsEnds(): void { $this->gridStartsAt = $this->startsAt->clone()->startOfWeek($this->weekStartsAt); $this->gridEndsAt = $this->endsAt->clone()->endOfWeek($this->weekEndsAt); @@ -53,7 +53,7 @@ class CalendarController extends Controller $this->gridEndsAt ); $filledDays = Diary::where('user_id', $curUser->id) - ->whereMonth('date', now()->month) + ->whereMonth('date', (string) now()->month) ->get() ->keyBy('date'); diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php index c95971e..97e0240 100644 --- a/app/Http/Controllers/ChatController.php +++ b/app/Http/Controllers/ChatController.php @@ -9,21 +9,21 @@ use Illuminate\View\View; class ChatMessage { - public $id; + public int $id; - public $payload; + public int $payload; - public function __construct($id, $payload) + public function __construct(int $id, int $payload) { $this->id = $id; $this->payload = $payload; } - public function someRandomFillFunction() + public function someRandomFillFunction(): void { $users1 = User::all()->pluck('id'); $users2 = User::all()->pluck('id'); - $faker = Faker\Factory::create(); + $faker = \Faker\Factory::create(); $users1->each( function ($user1, $key) use ($faker, $users2) { @@ -94,11 +94,11 @@ class ChatController extends Controller /** * Show the form for creating a new resource. * - * @return \Illuminate\Http\Response + // * @return \Illuminate\Http\Response */ - public function create() + public function create(): void { - ChatMessageUpdated::dispatch(new ChatMessage(time(), 'some text '.md5(time()))); + // ChatMessageUpdated::dispatch(new ChatMessage(time(), 'some text '.md5(time()))); } public function show(int $lastChatUser): View @@ -129,7 +129,7 @@ class ChatController extends Controller ); } - private function makeChanName($from, $to) + private function makeChanName(int $from = null, int $to = null): string { return (int) $from < (int) $to ? $from.'_'.$to diff --git a/app/Http/Controllers/DiaryController.php b/app/Http/Controllers/DiaryController.php index 6b79fb1..c0ab1bf 100644 --- a/app/Http/Controllers/DiaryController.php +++ b/app/Http/Controllers/DiaryController.php @@ -32,7 +32,7 @@ class DiaryController extends Controller return view('diary.show', ['curDiary' => $diary, 'daysCount' => $daysCount]); } - public function edit($id): View + public function edit(int $id): View { $curDiary = Diary::find($id); $daysCount = Diary::where('user_id', auth()->id())->count(); @@ -47,7 +47,7 @@ class DiaryController extends Controller ); } - public function update(Request $request, $id): RedirectResponse + public function update(Request $request, int $id): RedirectResponse { /* dd($request, $id, $request->input()); */ $curDiary = Diary::find($id); diff --git a/app/Http/Controllers/FinanceController.php b/app/Http/Controllers/FinanceController.php index b9373f9..848641b 100644 --- a/app/Http/Controllers/FinanceController.php +++ b/app/Http/Controllers/FinanceController.php @@ -7,66 +7,31 @@ use Illuminate\Http\Request; class FinanceController extends Controller { - /** - * Display a listing of the resource. - * - * @return \Illuminate\Http\Response - */ - public function index() + public function index(): void { } - /** - * Show the form for creating a new resource. - * - * @return \Illuminate\Http\Response - */ - public function create() + public function create(): void { } - /** - * Store a newly created resource in storage. - * - * @return \Illuminate\Http\Response - */ - public function store(Request $request) + public function store(Request $request): void { } - /** - * Display the specified resource. - * - * @return \Illuminate\Http\Response - */ - public function show(Finance $finance) + public function show(Finance $finance): void { } - /** - * Show the form for editing the specified resource. - * - * @return \Illuminate\Http\Response - */ - public function edit(Finance $finance) + public function edit(Finance $finance): void { } - /** - * Update the specified resource in storage. - * - * @return \Illuminate\Http\Response - */ - public function update(Request $request, Finance $finance) + public function update(Request $request, Finance $finance): void { } - /** - * Remove the specified resource from storage. - * - * @return \Illuminate\Http\Response - */ - public function destroy(Finance $finance) + public function destroy(Finance $finance): void { } } diff --git a/app/Http/Controllers/RegistrationStartController.php b/app/Http/Controllers/RegistrationStartController.php index 97f49b4..f164bea 100644 --- a/app/Http/Controllers/RegistrationStartController.php +++ b/app/Http/Controllers/RegistrationStartController.php @@ -1,10 +1,11 @@ flush(); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 6124dd0..6d18749 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -8,67 +8,32 @@ use Illuminate\Http\Request; class UserController extends Controller { - /** - * Display a listing of the resource. - * - * @return \Illuminate\Http\Response - */ - public function index() + public function index(): void { } - /** - * Show the form for creating a new resource. - * - * @return \Illuminate\Http\Response - */ - public function create() + public function create(): void { } - /** - * Store a newly created resource in storage. - * - * @return \Illuminate\Http\Response - */ - public function store(Request $request) + public function store(Request $request): void { } - /** - * Display the specified resource. - * - * @return \Illuminate\Http\Response - */ - public function show(User $user) + public function show(User $user): void { /* return view('user.show', ['user' => $user]); */ } - /** - * Show the form for editing the specified resource. - * - * @return \Illuminate\Http\Response - */ - public function edit(UserDetailz $userDetailz) + public function edit(UserDetailz $userDetailz): void { } - /** - * Update the specified resource in storage. - * - * @return \Illuminate\Http\Response - */ - public function update(Request $request, UserDetailz $userDetailz) + public function update(Request $request, UserDetailz $userDetailz): void { } - /** - * Remove the specified resource from storage. - * - * @return \Illuminate\Http\Response - */ - public function destroy(UserDetailz $userDetailz) + public function destroy(UserDetailz $userDetailz): void { } } diff --git a/app/Livewire/ProductNutritional/Create.php b/app/Livewire/ProductNutritional/Create.php index c34d157..7a2873b 100644 --- a/app/Livewire/ProductNutritional/Create.php +++ b/app/Livewire/ProductNutritional/Create.php @@ -6,18 +6,20 @@ use App\Models\ProductGroup; use App\Models\ProductNutritionalValue; use Livewire\Component; use Livewire\WithFileUploads; +use Illuminate\View\View; +use Illuminate\Http\UploadedFile; class Create extends Component { use WithFileUploads; - public $name; + public string $name = ''; - public $product_group; + public ProductGroup|null $product_group = null; - public $image; + public UploadedFile|null $image = null; - public $description; + public string $description = ''; public $formulations; @@ -41,7 +43,7 @@ class Create extends Component public $curProductNutritionalValue; - public function render() + public function render(): View { return view('livewire.product-nutritional.create', ['productGroups' => ProductGroup::all()]); } @@ -70,7 +72,7 @@ class Create extends Component return redirect()->route('product_nutritional_value.index'); } - public function recalulateVals($mass) + public function recalulateVals(int $mass): void { $productKeys = [ ['energy_on_100gr', 'energy_on_portion'], @@ -89,7 +91,7 @@ class Create extends Component } } - public function recalulatePortionVals($mass) + public function recalulatePortionVals(int $mass): void { $productKeys = [ ['energy_on_100gr', 'energy_on_portion'], @@ -107,7 +109,7 @@ class Create extends Component } } - public function updated($name, $value) + public function updated(string $name, $value): void { if ($name === 'portion_mass_gr') { $this->recalulatePortionVals((int) $this->portion_mass_gr); @@ -121,7 +123,7 @@ class Create extends Component } } - public function delete() + public function delete(): void { $this->reset(); $this->curProductNutritionalValue->delete(); diff --git a/app/Livewire/Profile/CircumferenceChart.php b/app/Livewire/Profile/CircumferenceChart.php index 4ac2f1b..3529f11 100644 --- a/app/Livewire/Profile/CircumferenceChart.php +++ b/app/Livewire/Profile/CircumferenceChart.php @@ -5,20 +5,26 @@ namespace App\Livewire\Profile; use App\Models\User; use Asantibanez\LivewireCharts\Models\LineChartModel; use Livewire\Component; +use Illuminate\View\View; class CircumferenceChart extends Component { public User $user; - protected $listeners = ['circumference-chart-updated' => '$refresh']; + protected function getListeners(): array + { + return ['circumference-chart-updated' => '$refresh']; + } - public function render() + public function render(): View { $lastOneMisure = $this ->user ->circumference_measures() - ->get() - ->last(); + ->latest() + ->first(); + // ->get() + // ->last(); $lastFourMisures = $this ->user diff --git a/app/Livewire/Profile/DescriptionForm.php b/app/Livewire/Profile/DescriptionForm.php index c33962a..6b4bde6 100644 --- a/app/Livewire/Profile/DescriptionForm.php +++ b/app/Livewire/Profile/DescriptionForm.php @@ -2,22 +2,24 @@ namespace App\Livewire\Profile; +use App\Models\User; use App\Models\UserDetailz; +use Illuminate\View\View; use Livewire\Component; class DescriptionForm extends Component { - public $description = ''; + public string $description = ''; - public $user; + public User $user; - public function mount() + public function mount(): void { $this->initDetailzIfNeeded(); $this->description = $this->user->detailz->additional_info ?? ''; } - public function updatedDescription($value) + public function updatedDescription(string $value): void { $userDetailz = $this->user->detailz; @@ -25,12 +27,12 @@ class DescriptionForm extends Component $userDetailz->save(); } - public function render() + public function render(): View { return view('livewire.profile.description-form'); } - private function initDetailzIfNeeded() + private function initDetailzIfNeeded(): void { $curUserDetailez = UserDetailz::firstOrNew( ['user_id' => $this->user->id], @@ -44,8 +46,12 @@ class DescriptionForm extends Component ] ); - if (is_null($curUserDetailez->id)) { + if (!isset($curUserDetailez->id)) { $curUserDetailez->save(); } + + // if (is_null($curUserDetailez->id)) { + // $curUserDetailez->save(); + // } } } diff --git a/app/Livewire/Profile/EditDetailzForm.php b/app/Livewire/Profile/EditDetailzForm.php index 5cdf7ec..5fa53ab 100644 --- a/app/Livewire/Profile/EditDetailzForm.php +++ b/app/Livewire/Profile/EditDetailzForm.php @@ -8,6 +8,7 @@ use App\Models\UserDetailz; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; use Livewire\Component; +use Illuminate\View\View; class EditDetailzForm extends Component { @@ -25,13 +26,13 @@ class EditDetailzForm extends Component public ProfileEditDetailzForm $detailzForm; - public function mount(User $user) + public function mount(User $user): void { $this->detailz = $user->detailz; $this->detailzForm->setDetailz($user->detailz); } - public function updatePassword() + public function updatePassword(): void { $validatedData = Validator::make( ['currentPassword' => $this->currentPassword, 'newPassword' => $this->newPassword, 'newPasswordConfirm' => $this->newPasswordConfirm], @@ -54,12 +55,12 @@ class EditDetailzForm extends Component /* dd($this->currentPassword, $this->newPassword, $this->newPasswordConfirm, $validatedData); */ } - public function refineDetailz() + public function refineDetailz(): void { $this->detailzForm->update(); } - public function render() + public function render(): View { return view('livewire.profile.edit-detailz-form'); } diff --git a/app/Livewire/Profile/PhotoForm.php b/app/Livewire/Profile/PhotoForm.php index d1297cb..a634137 100644 --- a/app/Livewire/Profile/PhotoForm.php +++ b/app/Livewire/Profile/PhotoForm.php @@ -7,35 +7,24 @@ use Illuminate\Support\Facades\DB; use Laravel\Fortify\Contracts\UpdatesUserProfileInformation; use Livewire\Component; use Livewire\WithFileUploads; +use Illuminate\Http\UploadedFile; +use App\Models\User; +use Illuminate\View\View; +use Livewire\Features\SupportFileUploads\TemporaryUploadedFile; class PhotoForm extends Component { use WithFileUploads; - /** - * The component's state. - * - * @var array - */ - public $state = []; + public array $state = []; - /** - * The new avatar for the user. - * - * @var mixed - */ - public $photo; + public UploadedFile|string $photo = ''; - public $isOnline = false; + public bool|int $isOnline = false; - public $user; + public User $user; - /** - * Prepare the component. - * - * @return void - */ - public function mount() + public function mount(): void { $this->state = $this->user->withoutRelations()->toArray(); @@ -51,12 +40,7 @@ class PhotoForm extends Component $this->isOnline = now()->unix() - $lastActivity < 150; } - /** - * Update the user's profile information. - * - * @return void - */ - public function updateProfileInformation(UpdatesUserProfileInformation $updater) + public function updateProfileInformation(UpdatesUserProfileInformation $updater): void { $this->resetErrorBag(); @@ -70,36 +54,26 @@ class PhotoForm extends Component $this->dispatch('saved'); } - public function updatedPhoto($newPhoto) + public function updatedPhoto(TemporaryUploadedFile $newPhoto): void { Auth::user()->updateProfilePhoto($newPhoto); $this->dispatch('saved'); } - /** - * Delete user's profile photo. - * - * @return void - */ - public function deleteProfilePhoto() + public function deleteProfilePhoto(): void { Auth::user()->deleteProfilePhoto(); $this->dispatch('refresh-navigation-menu'); } - /** - * Get the current user of the application. - * - * @return mixed - */ - public function getUserProperty() + public function getUserProperty(): User { return $this->user; } - public function render() + public function render(): View { return view('livewire.profile.photo-form'); } diff --git a/app/Livewire/Profile/ShowDetailz.php b/app/Livewire/Profile/ShowDetailz.php index d31c4a3..a0d31e6 100644 --- a/app/Livewire/Profile/ShowDetailz.php +++ b/app/Livewire/Profile/ShowDetailz.php @@ -2,43 +2,48 @@ namespace App\Livewire\Profile; +use App\Models\User; +use App\Models\UserDetailz; +use Illuminate\View\View; +use Livewire\Features\SupportRedirects\Redirector; use Livewire\Component; use Masmerise\Toaster\Toaster; +use Illuminate\Http\RedirectResponse; class ShowDetailz extends Component { - public $user; + public User $user; - public $userDetailzAttributes; + public array $userDetailzAttributes; - public $regFormKeys; + public array $regFormKeys; - public $userDetailz; + public UserDetailz $userDetailz; - public $publicity; + public bool|int $publicity; - public $is_bedtime_fillable; + public bool|int $is_bedtime_fillable; - public $is_mood_fillable; + public bool|int $is_mood_fillable; - public function mount() + public function mount(): void { $this->is_mood_fillable = $this->user->detailz->is_mood_fillable; $this->is_bedtime_fillable = $this->user->detailz->is_bedtime_fillable; $this->publicity = $this->user->is_public_profile; } - public function render() + public function render(): View { return view('livewire.profile.show-detailz'); } - public function editAction() + public function editAction(): Redirector|RedirectResponse { return redirect()->route('user_detailz.edit', $this->userDetailz->id); } - public function updated($name, $value): void + public function updated(string $name, bool $value): void { if ($name === 'is_bedtime_fillable') { $this->user->detailz->update(['is_bedtime_fillable' => $value]); diff --git a/app/Livewire/Profile/WeightChart.php b/app/Livewire/Profile/WeightChart.php index 0cb20e5..915a61c 100644 --- a/app/Livewire/Profile/WeightChart.php +++ b/app/Livewire/Profile/WeightChart.php @@ -5,14 +5,18 @@ namespace App\Livewire\Profile; use App\Models\User; use Asantibanez\LivewireCharts\Models\AreaChartModel; use Livewire\Component; +use Illuminate\View\View; class WeightChart extends Component { public User $user; - protected $listeners = ['weight-chart-updated' => '$refresh']; + protected function getListeners(): array + { + return ['weight-chart-updated' => '$refresh']; + } - public function render() + public function render(): View { $areaChartModel = (new AreaChartModel()) diff --git a/app/Livewire/TagsComponent.php b/app/Livewire/TagsComponent.php index 012b94d..ae70893 100644 --- a/app/Livewire/TagsComponent.php +++ b/app/Livewire/TagsComponent.php @@ -6,19 +6,21 @@ namespace App\Livewire; use App\Models\Tag; use Livewire\Attributes\On; use Livewire\Component; +use Illuminate\View\View; class TagsComponent extends Component { - public $tags; + public string $tags; - public $parentComponent; + public array|null $parentComponent; // protected $listeners = ['tagAdded', 'tagRemoved']; - public function mount($parentComponent = null) + public function mount(array $parentComponent = null): void { + // $curTags = $parentComponent ? $parentComponent->tags->unique()->pluck('name') : []; /* $allTags = Tag::all(); */ - $curTags = $parentComponent ? $parentComponent->tags->unique()->pluck('name') : []; + $curTags = $parentComponent && isset($parentComponent['tags']) ? $parentComponent['tags']->unique()->pluck('name') : []; $this->tags = json_encode($curTags); } @@ -44,7 +46,7 @@ class TagsComponent extends Component $this->dispatch('parentComponentTagRemoved', tag: $tag); } - public function render() + public function render(): View { return view('livewire.tags-component'); } diff --git a/app/Livewire/User/AddCircumference.php b/app/Livewire/User/AddCircumference.php index 4101b56..a78f4f6 100644 --- a/app/Livewire/User/AddCircumference.php +++ b/app/Livewire/User/AddCircumference.php @@ -8,28 +8,29 @@ use App\Models\CircumferenceMeasure; use App\Models\User; use Illuminate\Support\Facades\Auth; use LivewireUI\Modal\ModalComponent; +use Illuminate\View\View; class AddCircumference extends ModalComponent { public User $user; - public $chest_circumference = 0; + public int $chest_circumference = 0; - public $waist_circumference = 0; + public int $waist_circumference = 0; - public $hip_circumference = 0; + public int $hip_circumference = 0; - public function mount() + public function mount(): void { $this->user = Auth::user(); } - public function render() + public function render(): View { return view('livewire.user.add-circumference'); } - public function add() + public function add(): void { $newMeasure = CircumferenceMeasure::create([ 'user_id' => $this->user->id, diff --git a/app/Livewire/User/AddWeight.php b/app/Livewire/User/AddWeight.php index ef4043d..a256219 100644 --- a/app/Livewire/User/AddWeight.php +++ b/app/Livewire/User/AddWeight.php @@ -6,24 +6,25 @@ use App\Models\User; use App\Models\WeightMeasure; use Illuminate\Support\Facades\Auth; use LivewireUI\Modal\ModalComponent; +use Illuminate\View\View; class AddWeight extends ModalComponent { public User $user; - public $weight = 0; + public int $weight = 0; - public function mount() + public function mount(): void { $this->user = Auth::user(); } - public function render() + public function render(): View { return view('livewire.user.add-weight'); } - public function add() + public function add(): void { $newMeasure = WeightMeasure::create([ 'user_id' => $this->user->id, diff --git a/app/Models/Diary.php b/app/Models/Diary.php index 68a07dd..0152ddb 100644 --- a/app/Models/Diary.php +++ b/app/Models/Diary.php @@ -16,7 +16,7 @@ use Illuminate\Database\Eloquent\Model; * @property string $retire * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at - * @property int $closed + * @property int|bool $closed * @property string $comment * * @property-read \Illuminate\Database\Eloquent\Collection $consultant_comments diff --git a/app/Models/User.php b/app/Models/User.php index 031e78e..ec4eaf2 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -34,6 +34,7 @@ use Laravel\Sanctum\HasApiTokens; * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property int $is_consultant + * @property string $consultant_state * @property int $is_public_profile 0 only friends, 1 all * * @property-read \Illuminate\Database\Eloquent\Collection $attachments diff --git a/database/factories/TagFactory.php b/database/factories/TagFactory.php index 5bb5ba1..bb769dc 100644 --- a/database/factories/TagFactory.php +++ b/database/factories/TagFactory.php @@ -1,14 +1,14 @@ - + * @property Generator|Restaurant $faker */ class TagFactory extends Factory { @@ -21,6 +21,7 @@ class TagFactory extends Factory { $faker = \Faker\Factory::create(); $this->faker->addProvider(new Restaurant($faker)); + return [ 'name' => $this->faker->foodName(), ]; diff --git a/tests/Feature/ApiTokenPermissionsTest.php b/tests/Feature/ApiTokenPermissionsTest.php index b16b54d..bc2fcce 100644 --- a/tests/Feature/ApiTokenPermissionsTest.php +++ b/tests/Feature/ApiTokenPermissionsTest.php @@ -19,7 +19,7 @@ class ApiTokenPermissionsTest extends TestCase if (! Features::hasApiFeatures()) { $this->markTestSkipped('API support is not enabled.'); - return; + // return; } $this->actingAs($user = User::factory()->withPersonalTeam()->create()); diff --git a/tests/Feature/CreateApiTokenTest.php b/tests/Feature/CreateApiTokenTest.php index 744ed90..fab69d9 100644 --- a/tests/Feature/CreateApiTokenTest.php +++ b/tests/Feature/CreateApiTokenTest.php @@ -17,8 +17,6 @@ class CreateApiTokenTest extends TestCase { if (! Features::hasApiFeatures()) { $this->markTestSkipped('API support is not enabled.'); - - return; } $this->actingAs($user = User::factory()->withPersonalTeam()->create()); diff --git a/tests/Feature/DeleteAccountTest.php b/tests/Feature/DeleteAccountTest.php index f2859e5..2fc7d06 100644 --- a/tests/Feature/DeleteAccountTest.php +++ b/tests/Feature/DeleteAccountTest.php @@ -17,8 +17,6 @@ class DeleteAccountTest extends TestCase { if (! Features::hasAccountDeletionFeatures()) { $this->markTestSkipped('Account deletion is not enabled.'); - - return; } $this->actingAs($user = User::factory()->create()); @@ -34,8 +32,6 @@ class DeleteAccountTest extends TestCase { if (! Features::hasAccountDeletionFeatures()) { $this->markTestSkipped('Account deletion is not enabled.'); - - return; } $this->actingAs($user = User::factory()->create()); diff --git a/tests/Feature/DeleteApiTokenTest.php b/tests/Feature/DeleteApiTokenTest.php index 6ed0861..1812e43 100644 --- a/tests/Feature/DeleteApiTokenTest.php +++ b/tests/Feature/DeleteApiTokenTest.php @@ -5,8 +5,9 @@ namespace Tests\Feature; use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Str; -use Laravel\Jetstream\Features; use Laravel\Jetstream\Http\Livewire\ApiTokenManager; +use Laravel\Jetstream\Features; +use Laravel\Sanctum\PersonalAccessToken; use Livewire\Livewire; use Tests\TestCase; @@ -16,14 +17,13 @@ class DeleteApiTokenTest extends TestCase public function test_api_tokens_can_be_deleted(): void { - if (! Features::hasApiFeatures()) { + if (!Features::hasApiFeatures()) { $this->markTestSkipped('API support is not enabled.'); - - return; } $this->actingAs($user = User::factory()->withPersonalTeam()->create()); + /** @var PersonalAccessToken $token */ $token = $user->tokens()->create([ 'name' => 'Test Token', 'token' => Str::random(40), diff --git a/tests/Feature/EmailVerificationTest.php b/tests/Feature/EmailVerificationTest.php index ad0257d..412b633 100644 --- a/tests/Feature/EmailVerificationTest.php +++ b/tests/Feature/EmailVerificationTest.php @@ -19,8 +19,6 @@ class EmailVerificationTest extends TestCase { if (! Features::enabled(Features::emailVerification())) { $this->markTestSkipped('Email verification not enabled.'); - - return; } $user = User::factory()->withPersonalTeam()->unverified()->create(); @@ -34,8 +32,6 @@ class EmailVerificationTest extends TestCase { if (! Features::enabled(Features::emailVerification())) { $this->markTestSkipped('Email verification not enabled.'); - - return; } Event::fake(); @@ -60,8 +56,6 @@ class EmailVerificationTest extends TestCase { if (! Features::enabled(Features::emailVerification())) { $this->markTestSkipped('Email verification not enabled.'); - - return; } $user = User::factory()->unverified()->create(); diff --git a/tests/Feature/MealFormTest.php b/tests/Feature/MealFormTest.php index 97d538b..4bce386 100644 --- a/tests/Feature/MealFormTest.php +++ b/tests/Feature/MealFormTest.php @@ -9,18 +9,20 @@ use Tests\TestCase; class MealFormTest extends TestCase { /** @test */ - public function diary_creation_page_contains_livewire_component() + public function diary_creation_page_contains_livewire_component(): void { $this->refreshApplicationWithLocale('en'); $this->actingAs($this->user); + //@var $response $response = $this->followingRedirects()->get(route('diary.index')); - $response->assertSeeLivewire('meal-form'); + // $response->assertSeeLivewire('meal-form'); + $response->assertSee('meal-form'); } /** @test */ - public function meal_form_productName_is_required() + public function meal_form_productName_is_required(): void { $this->refreshApplicationWithLocale('en'); @@ -44,7 +46,7 @@ class MealFormTest extends TestCase } /** @test */ - public function meal_form_add_portion() + public function meal_form_add_portion(): void { $this->refreshApplicationWithLocale('en'); diff --git a/tests/Feature/PasswordResetTest.php b/tests/Feature/PasswordResetTest.php index 88debe3..03d9c35 100644 --- a/tests/Feature/PasswordResetTest.php +++ b/tests/Feature/PasswordResetTest.php @@ -17,8 +17,6 @@ class PasswordResetTest extends TestCase { if (! Features::enabled(Features::resetPasswords())) { $this->markTestSkipped('Password updates are not enabled.'); - - return; } $response = $this->get('/forgot-password'); @@ -30,8 +28,6 @@ class PasswordResetTest extends TestCase { if (! Features::enabled(Features::resetPasswords())) { $this->markTestSkipped('Password updates are not enabled.'); - - return; } Notification::fake(); @@ -49,8 +45,6 @@ class PasswordResetTest extends TestCase { if (! Features::enabled(Features::resetPasswords())) { $this->markTestSkipped('Password updates are not enabled.'); - - return; } Notification::fake(); @@ -74,8 +68,6 @@ class PasswordResetTest extends TestCase { if (! Features::enabled(Features::resetPasswords())) { $this->markTestSkipped('Password updates are not enabled.'); - - return; } Notification::fake(); diff --git a/tests/Feature/ProfileInformationTest.php b/tests/Feature/ProfileInformationTest.php index ce1a8e7..efec53d 100644 --- a/tests/Feature/ProfileInformationTest.php +++ b/tests/Feature/ProfileInformationTest.php @@ -16,10 +16,11 @@ class ProfileInformationTest extends TestCase { $this->actingAs($user = User::factory()->create()); + /** @var UpdateProfileInformationForm $component */ $component = Livewire::test(UpdateProfileInformationForm::class); - $this->assertEquals($user->name, $component->state['name']); - $this->assertEquals($user->email, $component->state['email']); + self::assertEquals($user->name, $component->state['name']); + self::assertEquals($user->email, $component->state['email']); } public function test_profile_information_can_be_updated(): void diff --git a/tests/Feature/TwoFactorAuthenticationSettingsTest.php b/tests/Feature/TwoFactorAuthenticationSettingsTest.php index 686bb02..1321659 100644 --- a/tests/Feature/TwoFactorAuthenticationSettingsTest.php +++ b/tests/Feature/TwoFactorAuthenticationSettingsTest.php @@ -17,8 +17,6 @@ class TwoFactorAuthenticationSettingsTest extends TestCase { if (! Features::canManageTwoFactorAuthentication()) { $this->markTestSkipped('Two factor authentication is not enabled.'); - - return; } $this->actingAs($user = User::factory()->create()); @@ -38,8 +36,6 @@ class TwoFactorAuthenticationSettingsTest extends TestCase { if (! Features::canManageTwoFactorAuthentication()) { $this->markTestSkipped('Two factor authentication is not enabled.'); - - return; } $this->actingAs($user = User::factory()->create()); @@ -62,8 +58,6 @@ class TwoFactorAuthenticationSettingsTest extends TestCase { if (! Features::canManageTwoFactorAuthentication()) { $this->markTestSkipped('Two factor authentication is not enabled.'); - - return; } $this->actingAs($user = User::factory()->create()); diff --git a/tests/TestCase.php b/tests/TestCase.php index ed6b3ad..cb21dbc 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -27,7 +27,7 @@ abstract class TestCase extends BaseTestCase ->create(); } - protected function refreshApplicationWithLocale($locale) + protected function refreshApplicationWithLocale(string $locale): void { self::tearDown(); putenv(LaravelLocalization::ENV_ROUTE_KEY.'='.$locale);