Completed
Branch master (a629f1)
by Manolo
09:41
created

ServiceTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 1
1
<?php
2
3
namespace Msalsas\GdprConsentBannerBundle\Tests;
4
5
use Msalsas\GdprConsentBannerBundle\Service\Service;
6
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
7
use Symfony\Component\HttpFoundation\Cookie;
8
use Symfony\Component\HttpFoundation\Response;
9
10
class ServiceTest extends WebTestCase
11
{
12
    protected $translator;
13
14
    public function test_get_response_with_accepted_cookie_should_return_response_with_cookie()
15
    {
16
        $service = new Service('12 days');
17
18
        $cookie = Cookie::create('msalsas-gdpr-consent-banner', 'accepted', strtotime('now + 12 days'));
19
        $expectedResponse = new Response("accepted");
20
        $expectedResponse->headers->setCookie($cookie);
21
22
        $response = $service->getResponseWithAcceptedCookie();
23
24
        $this->assertEquals($expectedResponse , $response);
25
    }
26
}