Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Migrating Carbon and Phpdotenv
There have been a number of implications for upgrading
carbon
andphpdotenv
. The changes contained below as well as all the submissions to this PR address the upgrade so all runs smoothly, tests don't fail and upgrading is seamless.Upgrading Carbon
The change in
composer.json
–upgrading from~1.0
tov2.0
– is critical aslaravel/cashier v10.5.*
requiresnesbot/carbon ^2.0
. Without this upgrade, this package won't work on Laravel 5.8 and upwards.carbon 1.0
has also been deprecated so this change has no other option but to take place.Laravel deprecations
The
fire
method, which was deprecated in Laravel 5.4, of theIlluminate\Events\Dispatcher
class in\Http\Controllers\WebhookController.php
has been removed. The fix is to use thedispatch
method.This event method now looks like this:
Unit test failures
Running this command
vendor/bin/phpunit
produces a number of errors due to the upgrade ofcarbon
and, more specifically,phpdotenv
from version2
to3
. There have been a number of core changes and deprecations.phpunit.xml
This error has been resolved:
Declaration incompatibility
This issue has been addressed across multiple files where
setUp()
method was implemented:PHP Fatal error: Declaration of Bgultekin\CashierFastspring\Tests\****Test::setUp() must be compatible with Orchestra\Testbench\TestCase::setUp()
The issue below was resolved in changes made to
Traits\Database.php
:PHP Fatal error: Declaration of Bgultekin\CashierFastspring\Tests\Traits\Database::tearDown() must be compatible with Orchestra\Testbench\TestCase::tearDown()
Dotenv constructor changes
The upgrade from version
2
to3
ofphpdotenv
meant I had to replace many occurrences ofnew Dotenv(...)
withDotenv::create(...)
since the new native constructor takes a Loader instance.This meant that
$dotenv = new \Dotenv\Dotenv(__DIR__);
changed to$dotenv = \Dotenv\Dotenv::create(__DIR__);
.Notably, Issue #306 discusses and implements the
Loader::load()
and its callers now return an associative array of variables loaded with their values, rather than an array of raw lines from the environment file. This issue hasn't been tested yet in this set of submitted patch changes so I don't know what this outcome will have on the code.Additional code failures
With all the above changes implemented
phpunit
now runs successfully but there are 4 of the 70 tests that are failing. Fixing these are outside the scope of the PR.