ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Dflydev\FigCookies\FigResponseCookiesTest Class Reference
+ Inheritance diagram for Dflydev\FigCookies\FigResponseCookiesTest:
+ Collaboration diagram for Dflydev\FigCookies\FigResponseCookiesTest:

Public Member Functions

 it_gets_cookies ()
 
 it_sets_cookies ()
 
 it_modifies_cookies ()
 
 it_removes_cookies ()
 

Detailed Description

Definition at line 5 of file FigResponseCookiesTest.php.

Member Function Documentation

◆ it_gets_cookies()

Dflydev\FigCookies\FigResponseCookiesTest::it_gets_cookies ( )
Test:

Definition at line 10 of file FigResponseCookiesTest.php.

References $response, Dflydev\FigCookies\SetCookie\create(), Dflydev\FigCookies\FigResponseCookies\get(), and Dflydev\FigCookies\SetCookies\SET_COOKIE_HEADER.

11  {
12  $response = (new FigCookieTestingResponse());
13 
15  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('theme', 'light'))
16  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('sessionToken', 'ENCRYPTED'))
17  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('hello', 'world'))
18  ;
19 
20  $this->assertEquals(
21  'ENCRYPTED',
22  FigResponseCookies::get($response, 'sessionToken')->getValue()
23  );
24  }
static create($name, $value=null)
Definition: SetCookie.php:173
const SET_COOKIE_HEADER
The name of the Set-Cookie header.
Definition: SetCookies.php:12
static get(ResponseInterface $response, $name, $value=null)
$response
+ Here is the call graph for this function:

◆ it_modifies_cookies()

Dflydev\FigCookies\FigResponseCookiesTest::it_modifies_cookies ( )
Test:

Definition at line 50 of file FigResponseCookiesTest.php.

References $response, Dflydev\FigCookies\SetCookie\create(), Dflydev\FigCookies\SetCookie\getName(), Dflydev\FigCookies\FigResponseCookies\modify(), Dflydev\FigCookies\SetCookies\SET_COOKIE_HEADER, and Dflydev\FigCookies\SetCookie\withValue().

51  {
52  $response = (new FigCookieTestingResponse());
53 
55  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('theme', 'light'))
56  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('sessionToken', 'ENCRYPTED'))
57  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('hello', 'world'))
58  ;
59 
60  $response = FigResponseCookies::modify($response, 'hello', function (SetCookie $setCookie) {
61  return $setCookie->withValue(strtoupper($setCookie->getName()));
62  });
63 
64  $this->assertEquals(
65  'theme=light,sessionToken=ENCRYPTED,hello=HELLO',
66  $response->getHeaderLine('Set-Cookie')
67  );
68  }
static create($name, $value=null)
Definition: SetCookie.php:173
const SET_COOKIE_HEADER
The name of the Set-Cookie header.
Definition: SetCookies.php:12
static modify(ResponseInterface $response, $name, $modify)
$response
+ Here is the call graph for this function:

◆ it_removes_cookies()

Dflydev\FigCookies\FigResponseCookiesTest::it_removes_cookies ( )
Test:

Definition at line 73 of file FigResponseCookiesTest.php.

References $response, Dflydev\FigCookies\SetCookie\create(), Dflydev\FigCookies\FigResponseCookies\remove(), and Dflydev\FigCookies\SetCookies\SET_COOKIE_HEADER.

74  {
75  $response = (new FigCookieTestingResponse());
76 
78  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('theme', 'light'))
79  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('sessionToken', 'ENCRYPTED'))
80  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('hello', 'world'))
81  ;
82 
84 
85  $this->assertEquals(
86  'theme=light,hello=world',
87  $response->getHeaderLine('Set-Cookie')
88  );
89  }
static remove(ResponseInterface $response, $name)
static create($name, $value=null)
Definition: SetCookie.php:173
const SET_COOKIE_HEADER
The name of the Set-Cookie header.
Definition: SetCookies.php:12
$response
+ Here is the call graph for this function:

◆ it_sets_cookies()

Dflydev\FigCookies\FigResponseCookiesTest::it_sets_cookies ( )
Test:

Definition at line 29 of file FigResponseCookiesTest.php.

References $response, Dflydev\FigCookies\SetCookie\create(), Dflydev\FigCookies\FigResponseCookies\set(), and Dflydev\FigCookies\SetCookies\SET_COOKIE_HEADER.

30  {
31  $response = (new FigCookieTestingResponse());
32 
34  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('theme', 'light'))
35  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('sessionToken', 'ENCRYPTED'))
36  ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('hello', 'world'))
37  ;
38 
40 
41  $this->assertEquals(
42  'theme=light,sessionToken=ENCRYPTED,hello=WORLD%21',
43  $response->getHeaderLine('Set-Cookie')
44  );
45  }
static set(ResponseInterface $response, SetCookie $setCookie)
static create($name, $value=null)
Definition: SetCookie.php:173
const SET_COOKIE_HEADER
The name of the Set-Cookie header.
Definition: SetCookies.php:12
$response
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: