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

DirectoryListingTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFixtureClasses() 0 4 1
B testDirectoryIndex() 0 28 1
1
<?php
2
3
namespace App\Tests\Acceptance;
4
5
use App\DataFixtures\UserReferenceTrait;
6
use App\DataFixtures\Users;
7
8
class DirectoryListingTest extends BaseAcceptanceTest
9
{
10
11
    use UserReferenceTrait;
12
13
    /**
14
     * {@inheritdoc}
15
     */
16
    protected function getFixtureClasses()
17
    {
18
        return [Users::class];
19
    }
20
21
    public function testDirectoryIndex()
22
    {
23
        $this->logIn($this->getUser(Users::COMMITTER));
24
25
        $crawler = $this->client->request('GET', '/browse/?action=list');
26
        $this->assertStatusCode(200, $this->client);
27
28
        $panels = $crawler->filter('.panel');
29
        $this->assertCount(2, $panels);
30
31
        $firstPanel = $panels->eq(0);
32
        $this->assertEquals('Folders', $firstPanel->filter('.panel-title')->text());
33
        $listGroupItems = $firstPanel->filter('.list-group-item');
34
        $this->assertCount(1, $listGroupItems);
35
        $this->assertEquals(
36
            'Examples',
37
            $listGroupItems->eq(0)->filter('.ddr-gitki-name a')->text()
38
        );
39
40
        $secondPanel = $panels->eq(1);
41
        $this->assertEquals('Files', $secondPanel->filter('.panel-title')->text());
42
        $listGroupItems = $secondPanel->filter('.list-group-item');
43
        $this->assertCount(1, $secondPanel->filter('.list-group-item'));
44
        $this->assertEquals(
45
            'index.md',
46
            trim($listGroupItems->eq(0)->filter('.ddr-gitki-name a')->text())
47
        );
48
    }
49
}
50