Completed
Push — master ( 402c8e...a49823 )
by Philip
22:11
created

IndexFileTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 5
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFixtureClasses() 0 4 1
A testIndexFileShown() 0 19 1
1
<?php
2
3
namespace App\Tests\Acceptance;
4
5
use App\DataFixtures\UserReferenceTrait;
6
use App\DataFixtures\Users;
7
8
class IndexFileTest extends BaseAcceptanceTest
9
{
10
    use UserReferenceTrait;
11
12
    /**
13
     * {@inheritdoc}
14
     */
15
    protected function getFixtureClasses()
16
    {
17
        return [Users::class];
18
    }
19
20
    public function testIndexFileShown()
21
    {
22
        $this->login($this->getUser(Users::COMMITTER));
23
24
        $crawler = $this->client->request('GET', '/');
0 ignored issues
show
Unused Code introduced by
$crawler 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...
25
        $this->assertStatusCode(302, $this->client);
26
27
        $location = $this->client->getResponse()->headers->get('Location');
28
        $this->assertEquals('/browse/?action=index', $location);
29
        $crawler = $this->client->request('GET', $location);
0 ignored issues
show
Unused Code introduced by
$crawler 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...
30
        $this->assertStatusCode(302, $this->client);
31
32
        $location = $this->client->getResponse()->headers->get('Location');
33
        $this->assertEquals('/browse/index.md', $location);
34
        $crawler = $this->client->request('GET', $location);
35
        $this->assertStatusCode(200, $this->client);
36
37
        $this->assertEquals('Welcome', $crawler->filter('h1')->text());
38
    }
39
}
40