|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ByTIC\Payments\Tests\Models\Methods\Traits; |
|
4
|
|
|
|
|
5
|
|
|
use Paytic\Payments\Mobilpay\Gateway as MobilpayGateway; |
|
6
|
|
|
use Paytic\Payments\Euplatesc\Gateway as EuplatescGateway; |
|
7
|
|
|
use ByTIC\Payments\Models\Methods\Types\BankTransfer; |
|
8
|
|
|
use ByTIC\Payments\Models\Methods\Types\Cash; |
|
9
|
|
|
use ByTIC\Payments\Models\Methods\Types\CreditCards; |
|
10
|
|
|
use ByTIC\Payments\Models\Methods\Types\Waiver; |
|
11
|
|
|
use Paytic\Payments\Tests\AbstractTest; |
|
12
|
|
|
use Paytic\Payments\Tests\Fixtures\Records\PaymentMethods\PaymentMethod; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Class RecordTraitTest |
|
16
|
|
|
* @package ByTIC\Payments\Tests\Models\Methods\Traits |
|
17
|
|
|
*/ |
|
18
|
|
|
class RecordTraitTest extends AbstractTest |
|
19
|
|
|
{ |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @dataProvider data_getType |
|
23
|
|
|
* |
|
24
|
|
|
* @param $type |
|
25
|
|
|
* @param $class |
|
26
|
|
|
*/ |
|
27
|
|
|
public function test_getType($type, $class) |
|
28
|
|
|
{ |
|
29
|
|
|
$method = new PaymentMethod(); |
|
30
|
|
|
$method->type = $type; |
|
31
|
|
|
|
|
32
|
|
|
self::assertInstanceOf($class, $method->getType()); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @return array |
|
37
|
|
|
*/ |
|
38
|
|
|
public function data_getType() |
|
39
|
|
|
{ |
|
40
|
|
|
return [ |
|
41
|
|
|
['bank-transfer', BankTransfer::class], |
|
42
|
|
|
['cash', Cash::class], |
|
43
|
|
|
['credit-cards', CreditCards::class], |
|
44
|
|
|
['waiver', Waiver::class], |
|
45
|
|
|
]; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @dataProvider data_getType_gateways |
|
51
|
|
|
* |
|
52
|
|
|
* @param $type |
|
53
|
|
|
* @param $class |
|
54
|
|
|
* @param $gateway |
|
55
|
|
|
*/ |
|
56
|
|
|
public function test_getType_gateways($type, $class, $gateway) |
|
|
|
|
|
|
57
|
|
|
{ |
|
58
|
|
|
$method = new PaymentMethod(); |
|
59
|
|
|
$method->type = $type; |
|
60
|
|
|
|
|
61
|
|
|
self::assertInstanceOf($class, $method->getType()); |
|
62
|
|
|
self::assertSame($type, $method->getType()->getGatewayName()); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @return array |
|
67
|
|
|
*/ |
|
68
|
|
|
public function data_getType_gateways() |
|
69
|
|
|
{ |
|
70
|
|
|
return [ |
|
71
|
|
|
['mobilpay', CreditCards::class, MobilpayGateway::class], |
|
72
|
|
|
['euplatesc', CreditCards::class, EuplatescGateway::class] |
|
73
|
|
|
]; |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.