Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checking the Wallet class extensibility #769

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/Infra/PackageModels/MyWallet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Bavix\Wallet\Test\Infra\PackageModels;

final class MyWallet extends \Bavix\Wallet\Models\Wallet
{
public function helloWorld(): string
{
return 'hello world';
}
}
31 changes: 31 additions & 0 deletions tests/Units/Expand/WalletTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace Bavix\Wallet\Test\Units\Expand;

use Bavix\Wallet\Test\Infra\Factories\BuyerFactory;
use Bavix\Wallet\Test\Infra\Models\Buyer;
use Bavix\Wallet\Test\Infra\PackageModels\MyWallet;
use Bavix\Wallet\Test\Infra\TestCase;

/**
* @internal
*/
final class WalletTest extends TestCase
{
public function testAddMethod(): void
{
config([
'wallet.wallet.model' => MyWallet::class,
]);

/** @var Buyer $buyer */
$buyer = BuyerFactory::new()->create();

/** @var MyWallet $wallet */
$wallet = $buyer->wallet;

self::assertSame('hello world', $wallet->helloWorld());
}
}