Completed
Push — master ( c310a2...2d8cb6 )
by Kazi Mainuddin
07:28 queued 05:39
created

StorageTest::getExtendedData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 14
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
namespace Tzsk\Payu\Tests\Helpers;
4
5
use Tzsk\Payu\Tests\TestCase;
6
use Illuminate\Support\Facades\Session;
7
use Tzsk\Payu\Helpers\Storage;
8
9
class StorageTest extends TestCase
10
{
11
    public function testItWillHaveSimpleStorageFields()
12
    {
13
        $data = $this->getSimpleData();
14
        $storage = new Storage();
15
16
        $this->assertEquals($data['status_url'], $storage->getStatusUrl());
17
        $this->assertEquals($data['payment'], $storage->getPayment());
18
        $this->assertNotEmpty($storage->getAccount());
19
        $this->assertEmpty($storage->getModel());
20
        $this->assertTrue(is_array($storage->getData()));
21
    }
22
23
    public function testItWillHaveCustomExtendedStorageFields()
24
    {
25
        $data = $this->getExtendedData();
0 ignored issues
show
Unused Code introduced by
$data 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...
26
        $storage = new Storage();
27
28
        $this->assertNotEmpty($storage->getAccount());
29
        $this->assertTrue(is_array($storage->getModel()));
30
        $this->assertTrue(is_array($storage->getData()));
31
    }
32
33
    public function getExtendedData()
34
    {
35
        $data = [
36
            'data' => [],
37
            'status_url' => 'foo',
38
            'account' => 'bar',
39
            'model' => ['id' => 1, 'class' => 'baz'],
40
            'payment' => 'foo'
41
        ];
42
43
        Session::put('tzsk_payu_data', $data);
44
45
        return $data;
46
    }
47
48
    public function getSimpleData()
49
    {
50
        $data = [
51
            'data' => [],
52
            'status_url' => 'foo',
53
            'account' => null,
54
            'model' => null,
55
            'payment' => 'foo'
56
        ];
57
58
        Session::put('tzsk_payu_data', $data);
59
60
        return $data;
61
    }
62
}
63