arborrow / montserrat

A retreat management application written in Laravel
12 stars 4 forks source link

Migrate to `spatie/laravel-html` #561

Closed arborrow closed 4 months ago

arborrow commented 5 months ago

This pull request includes the changes for migrating from the laravelcollective/html package to the spatie/laravel-html package. Feel free to commit any additional changes to the shift-109021 branch.

Before merging, you need to:

If you need help with your migration, check out the Human Shifts.

arborrow commented 5 months ago

:x: Shift detected calls to the selectYear and selectRange methods. While Spatie HTML has a select method, it does not automatically create the options range like LaravelCollective HTML.

Shift converted these with a placeholder function called options_range. You will need to add this function to your helpers file:

function options_range($start, $end): array
{
    return array_combine($range = range($start, $end), $range);
}
arborrow commented 5 months ago

:x: Shift found remaining references to the Form and Html facades provided by the laravelcollective/html package. You should review these references and manually convert them to their spatie/laravel-html equivalent or raw HTML to complete your migration.

arborrow commented 5 months ago

:alembic: This Shift is still being refined. Please report any issues or suggestions to shift@laravelshift.com. Your feedback is what helps improve the experience for everyone.

arborrow commented 5 months ago

Unit test result

There were 6 failures:

1) Tests\Feature\Http\Controllers\TouchpointControllerTest::edit_returns_an_ok_response Failed asserting that false is true. /var/www/html/tests/Feature/Http/Controllers/TouchpointControllerTest.php:229 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:177

2) Tests\Feature\Http\Controllers\LocationControllerTest::store_returns_an_ok_response PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'dicta' for key 'locations.locations_name_unique' in /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:580

3) Tests\Feature\Http\Controllers\PageControllerTest::finance_displays_view Expected response status code [200] but received 500. Failed asserting that 500 is identical to 200. The following exception occurred during the last request: BadMethodCallException: Method Spatie\Html\Html::link does not exist. in /var/www/html/vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php:112

4) Tests\Feature\Http\Controllers\RetreatControllerTest::edit_returns_an_ok_response Failed asserting that false is true. /var/www/html/tests/Feature/Http/Controllers/RetreatControllerTest.php:176 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:177

5) Tests\Feature\Http\Controllers\RegistrationControllerTest::edit_returns_an_ok_response Failed asserting that false is true. /var/www/html/tests/Feature/Http/Controllers/RegistrationControllerTest.php:251 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:177

6) Tests\Feature\Http\Controllers\RegistrationControllerTest::register_returns_an_ok_response Expected response status code [200] but received 500. Failed asserting that 500 is identical to 200. Error: Call to undefined function options_range() in /var/www/html/storage/framework/views/bc2a7a5065c67f41162fbf86ca67f8c2.php:95

FAILURES! Tests: 710, Assertions: 2770, Failures: 6.

arborrow commented 4 months ago

I noticed two issues. First, double url replacements producing url(url()) type issues. Second, I noticed that some Html::link references were skipped most likely because they spanned two lines.

arborrow commented 4 months ago

I also went ahead and fixed the missing stripe_balance_transaction_id on the payment edit form. This only impacts when there is a refund (not credit card type). I could have cleaned up the logic but decided it was best to add the data as a hidden field for the cases when it does not appear. I may want to go back and check the database to see if there are missing ids in payments table just to ensure that all stripe_balance_transactions_id are associated with a payment.

arborrow commented 4 months ago

fixes #557