Completed
Pull Request — master (#203)
by Alister
09:00
created

HeadersBuilderTest::testSetLastModified()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace Debril\RssAtomBundle\Tests\Response;
4
5
use Debril\RssAtomBundle\Response\HeadersBuilder;
6
use PHPUnit\Framework\TestCase;
7
use Symfony\Component\HttpFoundation\Response;
8
9
class HeadersBuilderTest extends TestCase
10
{
11
12 View Code Duplication
    public function testSetResponseHeadersPublic()
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...
13
    {
14
        $builder = new HeadersBuilder();
15
        $response = new Response();
16
17
        $builder->setResponseHeaders($response, 'xml', new \DateTime());
18
        $this->assertTrue($response->headers->getCacheControlDirective('public'));
19
        $this->assertEquals(3600, $response->getMaxAge());
20
    }
21
22 View Code Duplication
    public function testSetResponseHeadersPrivate()
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
        $builder = new HeadersBuilder(false, 30);
25
        $response = new Response();
26
27
        $builder->setResponseHeaders($response, 'xml', new \DateTime());
28
        $this->assertTrue($response->headers->getCacheControlDirective('private'));
29
        $this->assertEquals(30, $response->getMaxAge());
30
    }
31
32
    public function testSetLastModified()
33
    {
34
        $builder = new HeadersBuilder();
35
        $response = new Response();
36
        $date = new \DateTime('2018-01-01');
37
38
        $builder->setResponseHeaders($response, 'xml', $date);
39
        $this->assertEquals($date, $response->getLastModified());
40
    }
41
42
43
}
44