feat: add Laravel 11/12 and PHP 8.3+ support

- Widen illuminate/* deps to ^10.0|^11.0|^12.0, require PHP ^8.3
- Upgrade PHPUnit to ^10.5|^11.0, Mockery to ^1.6
- Rewrite phpunit.xml.dist for PHPUnit 10+ format (source/include
  replaces filter/whitelist, removed deprecated attributes)
- Replace $dates with $casts on Token model
- Implement DeferrableProvider interface instead of $defer property
  on ClientServiceProvider
- Use FQCN route definitions instead of string-based namespace()
- Fix migration getColumnType() check for Laravel 11+ native types
- Replace @test doc annotations with #[Test] attributes
- Fix dynamic property deprecation in ControllerTest
This commit is contained in:
Joel Male
2026-02-18 10:29:34 +10:00
parent 32f5c22846
commit 8ec2c3cc38
12 changed files with 86 additions and 157 deletions
+13 -17
View File
@@ -11,6 +11,7 @@
use Illuminate\Session\Store;
use Mockery;
use Mockery\Mock;
use PHPUnit\Framework\Attributes\Test;
use QuickBooksOnline\API\DataService\DataService;
use Wearepixel\QuickBooks\Client as QuickBooks;
use Wearepixel\QuickBooks\TestCase;
@@ -50,6 +51,11 @@ class ControllerTest extends TestCase
*/
protected $session_mock;
/**
* @var Mock
*/
protected $url_generator_mock;
/**
* @var Mock
*/
@@ -67,23 +73,20 @@ protected function setUp(): void
$this->redirector_mock = Mockery::mock(Redirector::class);
$this->request_mock = Mockery::mock(Request::class);
$this->session_mock = Mockery::mock(Store::class);
$this->url_generator_mock = Mockery::mock(UrlGenerator::class);
$this->view_factory_mock = Mockery::mock(ViewFactory::class);
$this->view_mock = Mockery::mock(View::class);
$this->controller = new Controller();
$this->controller = new Controller;
}
/**
* @test
*/
#[Test]
public function it_can_be_constructed()
{
$this->assertInstanceOf(Controller::class, $this->controller);
}
/**
* @test
*/
#[Test]
public function it_shows_view_to_connect_if_account_not_linked()
{
$this->data_service_mock
@@ -126,9 +129,7 @@ public function it_shows_view_to_connect_if_account_not_linked()
$this->controller->connect($this->quickbooks_mock, $this->view_factory_mock);
}
/**
* @test
*/
#[Test]
public function it_shows_view_to_disconnect_if_account_linked()
{
$this->quickbooks_mock
@@ -158,9 +159,7 @@ public function it_shows_view_to_disconnect_if_account_linked()
$this->controller->connect($this->quickbooks_mock, $this->view_factory_mock);
}
/**
* @test
*/
#[Test]
public function it_disconnects_from_quickbooks_when_requested()
{
$this->request_mock
@@ -192,12 +191,9 @@ public function it_disconnects_from_quickbooks_when_requested()
$this->assertInstanceOf(RedirectResponse::class, $result);
}
/**
* @test
*/
#[Test]
public function it_finishes_connecting_to_quickbooks_when_given_a_valid_token_by_quickbooks()
{
$this->url_generator_mock = Mockery::mock(UrlGenerator::class);
$realmId = random_int(1, 9999);
$this->quickbooks_mock
+4 -9
View File
@@ -8,6 +8,7 @@
use Illuminate\Routing\Redirector;
use Mockery;
use Mockery\Mock;
use PHPUnit\Framework\Attributes\Test;
use Wearepixel\QuickBooks\Client as QuickBooks;
use Wearepixel\QuickBooks\TestCase;
@@ -62,17 +63,13 @@ protected function setUp(): void
);
}
/**
* @test
*/
#[Test]
public function it_can_be_constructed()
{
$this->assertInstanceOf(Filter::class, $this->filter);
}
/**
* @test
*/
#[Test]
public function it_just_passes_the_request_to_the_next_middleware_if_account_linked_to_quickbooks()
{
$next_middleware = function ($request) {
@@ -88,9 +85,7 @@ public function it_just_passes_the_request_to_the_next_middleware_if_account_lin
$this->filter->handle($this->request_mock, $next_middleware);
}
/**
* @test
*/
#[Test]
public function it_redirects_to_quickbooks_connect_route_after_setting_intended_session_if_account_not_linked()
{
$this->request_mock