feat: migrate test suite from PHPUnit to Pest

- Replace phpunit/phpunit with pestphp/pest ^3.0
- Drop scrutinizer/ocular (incompatible with Pest's symfony/console)
- Add tests/Pest.php with MockeryPHPUnitIntegration trait binding
- Extract namespace-level function stubs (config, route, dir) to
  tests/Overrides.php, loaded via autoload-dev files
- Convert all 5 test classes to Pest closure-based syntax:
  setUp() → beforeEach(), assertions → expect(), skip() for skipped tests
- Delete tests/TestCase.php (logic moved to Pest.php)
- Stubs (TokenStub, User) unchanged
This commit is contained in:
Joel Male
2026-02-18 10:38:20 +10:00
parent 8ec2c3cc38
commit 97c04ec693
9 changed files with 426 additions and 830 deletions
+10 -30
View File
@@ -1,36 +1,16 @@
<?php
namespace Wearepixel\QuickBooks;
use PHPUnit\Framework\Attributes\Test;
use Wearepixel\QuickBooks\Stubs\User;
use Wearepixel\QuickBooks\Token;
/**
* Class HasQuickBooksTokenTest
*/
class HasQuickBooksTokenTest extends TestCase
{
/**
* @var User
*/
protected $user;
beforeEach(function () {
$this->user = new User;
});
protected function setUp(): void
{
parent::setUp();
it('can be constructed', function () {
expect($this->user)->toBeInstanceOf(User::class);
});
$this->user = new User;
}
#[Test]
public function it_can_be_constructed()
{
$this->assertInstanceOf(User::class, $this->user);
}
#[Test]
public function it_has_a_has_one_relationship_to_token()
{
$this->assertInstanceOf(Token::class, $this->user->quickBooksToken()->getModel());
}
}
it('has a hasOne relationship to token', function () {
expect($this->user->quickBooksToken()->getModel())->toBeInstanceOf(Token::class);
});