GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

WorkspaceCheckinTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
B testPostWorkspaceCheck() 0 24 1
A testDeletePostWorkspaceCheck() 0 21 1
1
<?php
2
3
namespace Tests;
4
5
use Silex\WebTestCase;
6
use JsonSchema\Validator;
7
8
class WorkspaceCheckinTest extends PartTest
9
{
10
    use AbstractAppTest;
11
12
13
    public function testPostWorkspaceCheck() {
14
        $blob = $this->testPostWorkspacePart();
15
        $id = $blob[0];
16
        $part_id = $blob[1];
17
18
        $client = $this->createClient();
19
        $client = $this->logIn2($client);
20
        $client->request(
21
            'POST',
22
            '/api/v1/workspace/'.$id.'/part/'.$part_id.'/checkin',
23
            [],
24
            [],
25
            ['CONTENT_TYPE' => 'application/json'],
26
            '');
27
        $response = $client->getResponse();
0 ignored issues
show
Unused Code introduced by
$response 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...
28
        $data = $client->getResponse()->getContent();
29
30
        $js = json_decode($data);
31
        $points = $js->points;
32
33
        $this->assertTrue(is_numeric($points)); //TODO verificare che il numero sia adeguato ai punti attesi
34
35
        return [$id, $part_id];
36
    }
37
38
    public function testDeletePostWorkspaceCheck() {
39
        $blob = $this->testPostWorkspaceCheck();
40
        $id = $blob[0];
41
        $part_id = $blob[1];
42
43
        $client = $this->createClient();
44
        $client = $this->logIn2($client);
45
        $client->request(
46
            'DELETE',
47
            '/api/v1/workspace/'.$id.'/part/'.$part_id.'/checkin',
48
            [],
49
            [],
50
            ['CONTENT_TYPE' => 'application/json'],
51
            '');
52
        $response = $client->getResponse();
53
54
55
        $this->assertEquals(204, $response->getStatusCode()); //TODO verificare che il dato non sia più presente sul server
56
57
        return [$id, $part_id];
58
    }
59
}
60