Completed
Push — master ( fc7027...e72ab1 )
by Philip
24:06
created

tests/Acceptance/IndexFileTest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
        $referenceRepository = $this->loadFixtures([Users::class])->getReferenceRepository();
23
        $client = $this->makeBrowser();
24
25
        $this->login($client, $this->getUser(Users::COMMITTER, $referenceRepository));
26
27
        $crawler = $client->request('GET', '/');
0 ignored issues
show
$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...
28
//        $this->assertStatusCode(302, $client);
29
        $this->assertEquals(302, $client->getResponse()->getStatusCode());
30
31
        $location = $client->getResponse()->headers->get('Location');
32
        $this->assertEquals('/browse/?action=index', $location);
33
        $crawler = $client->request('GET', $location);
34
//        $this->assertStatusCode(302, $client);
35
36
        $this->assertEquals(302, $client->getResponse()->getStatusCode());
37
        $location = $client->getResponse()->headers->get('Location');
38
        $this->assertEquals('/browse/index.md', $location);
39
        $crawler = $client->request('GET', $location);
40
//        $this->assertStatusCode(200, $client);
41
42
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
43
        $this->assertEquals('Welcome', $crawler->filter('h1')->text());
44
    }
45
}
46