mirror of
https://github.com/wearepixel/laravel-quickbooks.git
synced 2026-11-14 14:01:46 +00:00
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:
+14
-37
@@ -5,6 +5,7 @@
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Mockery;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use QuickBooksOnline\API\Core\OAuth\OAuth2\OAuth2AccessToken;
|
||||
use Wearepixel\QuickBooks\Stubs\TokenStub;
|
||||
use Wearepixel\QuickBooks\Stubs\User;
|
||||
@@ -21,52 +22,40 @@ class TokenTest extends TestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->token = new TokenStub();
|
||||
$this->token = new TokenStub;
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_can_be_constructed()
|
||||
{
|
||||
$this->assertInstanceOf(Token::class, $this->token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_has_accessor_for_valid_access_token()
|
||||
{
|
||||
$this->assertNotNull($this->token->getHasValidAccessTokenAttribute());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_has_accessor_for_valid_refresh_token()
|
||||
{
|
||||
$this->assertNotNull($this->token->getHasValidRefreshTokenAttribute());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_knows_that_the_access_token_expires_at_has_to_be_valid()
|
||||
{
|
||||
$this->assertFalse($this->token->getHasValidAccessTokenAttribute());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_knows_that_the_refresh_token_expires_at_has_to_be_valid()
|
||||
{
|
||||
$this->assertFalse($this->token->getHasValidRefreshTokenAttribute());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_know_if_access_token_expires_at_is_less_than_now_it_is_not_expired()
|
||||
{
|
||||
$now = Carbon::now();
|
||||
@@ -77,9 +66,7 @@ public function it_know_if_access_token_expires_at_is_less_than_now_it_is_not_ex
|
||||
$this->assertTrue($this->token->getHasValidAccessTokenAttribute());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_know_if_refresh_token_expires_at_is_less_than_now_it_is_not_expired()
|
||||
{
|
||||
$now = Carbon::now();
|
||||
@@ -90,9 +77,7 @@ public function it_know_if_refresh_token_expires_at_is_less_than_now_it_is_not_e
|
||||
$this->assertTrue($this->token->getHasValidRefreshTokenAttribute());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_know_if_access_token_expires_at_is_greater_than_or_equal_to_now_it_is_expired()
|
||||
{
|
||||
$now = Carbon::now();
|
||||
@@ -107,9 +92,7 @@ public function it_know_if_access_token_expires_at_is_greater_than_or_equal_to_n
|
||||
$this->assertFalse($this->token->getHasValidAccessTokenAttribute());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_know_if_refresh_token_expires_at_is_greater_than_or_equal_to_now_it_is_expired()
|
||||
{
|
||||
$now = Carbon::now();
|
||||
@@ -124,9 +107,7 @@ public function it_know_if_refresh_token_expires_at_is_greater_than_or_equal_to_
|
||||
$this->assertFalse($this->token->getHasValidRefreshTokenAttribute());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_stores_the_oauth_token_parts_in_expected_properties()
|
||||
{
|
||||
$oauth_token_mock = Mockery::mock(OAuth2AccessToken::class);
|
||||
@@ -164,9 +145,7 @@ public function it_stores_the_oauth_token_parts_in_expected_properties()
|
||||
$this->token->parseOauthToken($oauth_token_mock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_allows_itself_to_be_deleted_and_returns_new_token()
|
||||
{
|
||||
$this->token->user = Mockery::mock(User::class);
|
||||
@@ -191,9 +170,7 @@ public function it_allows_itself_to_be_deleted_and_returns_new_token()
|
||||
$this->assertEquals($token_mock, $this->token->remove());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function it_get_related_user_model_from_configuration()
|
||||
{
|
||||
$this->assertInstanceOf(User::class, $this->token->user()->getModel());
|
||||
|
||||
Reference in New Issue
Block a user