Completed
Branch master (3a051a)
by Songda
01:40
created

PayTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 24
rs 10
c 3
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testAlipayGateway() 0 6 1
A testWechatGateway() 0 6 1
A testFooGateway() 0 7 1
1
<?php
2
3
namespace Yansongda\Pay\Tests;
4
5
use Yansongda\Pay\Contracts\GatewayApplicationInterface;
6
use Yansongda\Pay\Exceptions\GatewayException;
7
use Yansongda\Pay\Pay;
8
9
class PayTest extends TestCase
10
{
11
    public function testAlipayGateway()
12
    {
13
        $alipay = Pay::alipay(['foo' => 'bar']);
14
15
        $this->assertInstanceOf(GatewayApplicationInterface::class, $alipay);
16
    }
17
18
    public function testWechatGateway()
19
    {
20
        $wechat = Pay::wechat(['foo' => 'bar']);
21
22
        $this->assertInstanceOf(GatewayApplicationInterface::class, $wechat);
23
    }
24
25
    public function testFooGateway()
26
    {
27
        $this->expectException(GatewayException::class);
28
        $this->expectExceptionMessage('Gateway [foo] Not Exists');
29
30
        $foo = Pay::foo([]);
0 ignored issues
show
Unused Code introduced by
$foo is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
31
    }
32
}
33