ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.

11 {
12 $response = (new FigCookieTestingResponse());
13
15 ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('theme', 'light'))
18 ;
19
20 $this->assertEquals(
21 'ENCRYPTED',
22 FigResponseCookies::get($response, 'sessionToken')->getValue()
23 );
24 }
static get(ResponseInterface $response, $name, $value=null)
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

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

+ 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.

51 {
52 $response = (new FigCookieTestingResponse());
53
55 ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('theme', 'light'))
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 modify(ResponseInterface $response, $name, $modify)

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

+ 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.

74 {
75 $response = (new FigCookieTestingResponse());
76
78 ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('theme', 'light'))
81 ;
82
84
85 $this->assertEquals(
86 'theme=light,hello=world',
87 $response->getHeaderLine('Set-Cookie')
88 );
89 }
static remove(ResponseInterface $response, $name)

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

+ 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.

30 {
31 $response = (new FigCookieTestingResponse());
32
34 ->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('theme', 'light'))
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)

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

+ Here is the call graph for this function:

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