RecordTraitTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 16
c 1
b 0
f 0
dl 0
loc 55
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A data_getType() 0 7 1
A data_getType_gateways() 0 5 1
A test_getType_gateways() 0 7 1
A test_getType() 0 6 1
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)
0 ignored issues
show
Unused Code introduced by
The parameter $gateway is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

56
    public function test_getType_gateways($type, $class, /** @scrutinizer ignore-unused */ $gateway)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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