CreateWepayAccountTest::testCreateWepayAccount_()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 33
c 0
b 0
f 0
rs 9.392
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Containers\Wepay\UI\API\Tests\Functional;
4
5
use App\Containers\Wepay\Tests\ApiTestCase;
6
7
/**
8
 * Class CreateWepayAccountTest.
9
 *
10
 * @group wepay
11
 * @group api
12
 *
13
 * @author Rockers Technologies <[email protected]>
14
 */
15
class CreateWepayAccountTest extends ApiTestCase
16
{
17
18
    protected $endpoint = '[email protected]/user/payments/accounts/wepay';
19
20
    protected $access = [
21
        'permissions' => '',
22
        'roles'       => '',
23
    ];
24
25
    /**
26
     * @test
27
     */
28
    public function testCreateWepayAccount_()
29
    {
30
        $userDetails = [
31
            'name'     => $this->faker->name,
32
            'email'    => $this->faker->email,
33
            'password' => '123456789',
34
        ];
35
        
36
        // get the logged in user (create one if no one is logged in)
37
        $user = $this->getTestingUser($userDetails);
0 ignored issues
show
Unused Code introduced by Jaimin Suthar
$user 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...
38
39
        $data = [
40
            'name'          => $this->faker->name,
41
            'description'   => $this->faker->text(50),
42
            'type'          => 'personal',
43
            'imageUrl'      => 'https://someurl.com',
44
            'country'       => 'US',
45
            'currencies'    => 'USD',
46
            'nickname'      => 'test account for wepay',
47
        ];
48
49
        // send the HTTP request
50
        $response = $this->makeCall($data);
51
52
        // assert response status is correct
53
        $response->assertStatus(202);
54
55
        // convert JSON response string to Object
56
        $responseContent = $this->getResponseContentObject();
57
58
        $this->assertEquals($responseContent->message, 'Wepay account created successfully.');
59
60
    }
61
62
}
63