Skip to content

Commit 4f39e5c

Browse files
author
Andrey Helldar
committed
Fixed tests
1 parent 79a1f3d commit 4f39e5c

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
"require": {
2525
"php": "^7.3|^8.0",
2626
"ext-json": "*",
27-
"andrey-helldar/cashier": "^1.0-BETA9",
28-
"andrey-helldar/contracts": "^1.5-BETA17",
27+
"andrey-helldar/contracts": "^1.5",
2928
"andrey-helldar/simple-data-transfer-object": "^1.0",
3029
"andrey-helldar/support": "^4.0",
3130
"illuminate/support": "^6.0|^7.0|^8.0"
3231
},
3332
"require-dev": {
33+
"andrey-helldar/cashier": "^v1.0-BETA22",
3434
"orchestra/testbench": "^4.0|^5.0|^6.0",
3535
"phpunit/phpunit": "^9.0",
3636
"symfony/var-dumper": "^4.3.4|^5.0"

tests/Fixtures/ModelResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function sum(): float
4545
return TestCase::SUM;
4646
}
4747

48-
protected function currency(): string
48+
protected function currency(): int
4949
{
5050
return TestCase::CURRENCY;
5151
}

tests/Support/Auth/BodyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testBasic()
3434
$this->assertSame([
3535
'PaymentId' => self::PAYMENT_ID,
3636
'Sum' => self::SUM_RESULT,
37-
'Currency' => self::CURRENCY,
37+
'Currency' => self::CURRENCY_RESULT,
3838
'CreatedAt' => self::CREATED_AT_RESULT,
3939
'TerminalKey' => self::TERMINAL_KEY,
4040
'Token' => self::TOKEN,
@@ -49,7 +49,7 @@ public function testHash()
4949
$this->assertSame([
5050
'PaymentId' => self::PAYMENT_ID,
5151
'Sum' => self::SUM_RESULT,
52-
'Currency' => self::CURRENCY,
52+
'Currency' => self::CURRENCY_RESULT,
5353
'CreatedAt' => self::CREATED_AT_RESULT,
5454
'TerminalKey' => self::TERMINAL_KEY,
5555
'Token' => self::TOKEN_HASH,

tests/TestCase.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
namespace Tests;
1919

20-
use Helldar\CashierDriver\Tinkoff\Auth\Support\Auth;
20+
use Helldar\Cashier\Config\Driver;
21+
use Helldar\Cashier\Constants\Driver as DriverConstant;
22+
use Helldar\Contracts\Cashier\Config\Driver as DriverCotract;
2123
use Helldar\Contracts\Cashier\Http\Request;
2224
use Helldar\Contracts\Cashier\Resources\Model;
2325
use Orchestra\Testbench\TestCase as BaseTestCase;
@@ -38,7 +40,9 @@ abstract class TestCase extends BaseTestCase
3840

3941
public const SUM_RESULT = 12345;
4042

41-
public const CURRENCY = '123';
43+
public const CURRENCY = 123;
44+
45+
public const CURRENCY_RESULT = '123';
4246

4347
public const CREATED_AT = '2021-07-29 18:51:03';
4448

@@ -66,11 +70,22 @@ protected function model(): Model
6670
{
6771
$eloquent = new ModelEloquent();
6872

69-
return new ModelResource($eloquent);
73+
$config = $this->config();
74+
75+
return new ModelResource($eloquent, $config);
76+
}
77+
78+
protected function config(): DriverCotract
79+
{
80+
return Driver::make([
81+
DriverConstant::CLIENT_ID => self::TERMINAL_KEY,
82+
83+
DriverConstant::CLIENT_SECRET => self::TOKEN,
84+
]);
7085
}
7186

7287
protected function request(): Request
7388
{
74-
return Fixtures\Request::make($this->model(), Auth::class);
89+
return Fixtures\Request::make($this->model());
7590
}
7691
}

0 commit comments

Comments
 (0)