Skip to content

Commit 80d31e8

Browse files
authored
Merge pull request #769 from bavix/add-method
checking the Wallet class extensibility
2 parents fa4e182 + 1632e28 commit 80d31e8

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bavix\Wallet\Test\Infra\PackageModels;
6+
7+
final class MyWallet extends \Bavix\Wallet\Models\Wallet
8+
{
9+
public function helloWorld(): string
10+
{
11+
return 'hello world';
12+
}
13+
}

tests/Units/Expand/WalletTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bavix\Wallet\Test\Units\Expand;
6+
7+
use Bavix\Wallet\Test\Infra\Factories\BuyerFactory;
8+
use Bavix\Wallet\Test\Infra\Models\Buyer;
9+
use Bavix\Wallet\Test\Infra\PackageModels\MyWallet;
10+
use Bavix\Wallet\Test\Infra\TestCase;
11+
12+
/**
13+
* @internal
14+
*/
15+
final class WalletTest extends TestCase
16+
{
17+
public function testAddMethod(): void
18+
{
19+
config([
20+
'wallet.wallet.model' => MyWallet::class,
21+
]);
22+
23+
/** @var Buyer $buyer */
24+
$buyer = BuyerFactory::new()->create();
25+
26+
/** @var MyWallet $wallet */
27+
$wallet = $buyer->wallet;
28+
29+
self::assertSame('hello world', $wallet->helloWorld());
30+
}
31+
}

0 commit comments

Comments
 (0)