ExceptionTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A dataProviderSetUp() 0 5 1
A testSetUp() 0 7 1
1
<?php
2
namespace RazonYang\Yii2\JSend\Tests;
3
4
use PHPUnit\Framework\TestCase;
5
use RazonYang\JSend\Exception;
6
7
class ExceptionTest extends TestCase
8
{
9
    /**
10
     * @dataProvider dataProviderSetUp
11
     */
12
    public function testSetUp($message, $code, $data = null, $previous = null): void
13
    {
14
        $e = new Exception($message, $code, $data, $previous);
15
        $this->assertSame($message, $e->getMessage());
16
        $this->assertSame($code, $e->getCode());
17
        $this->assertSame($previous, $e->getPrevious());
18
        $this->assertSame($data, $e->getData());
19
    }
20
21
    public function dataProviderSetUp(): array
22
    {
23
        return [
24
            ['foo', 0, null, null],
25
            ['bar', 1, 'fuzz', new \Exception()],
26
        ];
27
    }
28
}
29