Passed
Branch master (7fc895)
by João Felipe Magro
03:00
created

SerializerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testSerialize() 0 17 1
1
<?php
2
3
namespace Tests\Classes\Services;
4
5
use Ipag\Classes\Authentication;
6
use Ipag\Classes\Enum\Action;
7
use Ipag\Classes\Enum\Operation;
8
use Ipag\Classes\Serializer\Serializer;
9
use Ipag\Ipag;
10
use PHPUnit\Framework\TestCase;
11
12
class SerializerTest extends TestCase
13
{
14
    public function testSerialize()
15
    {
16
        $ipag = new Ipag(new Authentication('[email protected]'));
17
18
        $transaction = $ipag->transaction()->setTid('123456789');
19
20
        $cancelSerializer = new Serializer($transaction, Action::CONSULT, Operation::CONSULT);
21
22
        $response = $cancelSerializer->serialize();
23
24
        $expected = [
25
            'identificacao' => urlencode('[email protected]'),
26
            'transId'       => urlencode('123456789'),
27
            'retorno_tipo'  => urlencode('xml'),
28
        ];
29
30
        $this->assertEquals($expected, $response);
31
    }
32
}
33