Completed
Branch erdiko2 (40e193)
by John
04:03
created

HomepageTest::testGetHomepageWithoutName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Tests\Functional;
4
5
class HomepageTest extends BaseTestCase
6
{
7
    /**
8
     * Test that the index route returns a rendered response containing the text 'SlimFramework' but not a greeting
9
     */
10 View Code Duplication
    public function testGetHomepageWithoutName()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
    {
12
        $response = $this->runApp('GET', '/');
13
14
        $this->assertEquals(200, $response->getStatusCode());
15
        $this->assertContains('SlimFramework', (string)$response->getBody());
16
        $this->assertNotContains('Hello', (string)$response->getBody());
17
    }
18
19
    /**
20
     * Test that the index route with optional name argument returns a rendered greeting
21
     */
22 View Code Duplication
    public function testGetHomepageWithGreeting()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
    {
24
        $response = $this->runApp('GET', '/name');
25
26
        $this->assertEquals(200, $response->getStatusCode());
27
        $this->assertContains('Hello name!', (string)$response->getBody());
28
    }
29
30
    /**
31
     * Test that the index route won't accept a post request
32
     */
33 View Code Duplication
    public function testPostHomepageNotAllowed()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
34
    {
35
        $response = $this->runApp('POST', '/', ['test']);
36
37
        $this->assertEquals(405, $response->getStatusCode());
38
        $this->assertContains('Method not allowed', (string)$response->getBody());
39
    }
40
}