ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Dflydev\FigCookies\FigRequestCookiesTest Class Reference
+ Inheritance diagram for Dflydev\FigCookies\FigRequestCookiesTest:
+ Collaboration diagram for Dflydev\FigCookies\FigRequestCookiesTest:

Public Member Functions

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

Detailed Description

Definition at line 5 of file FigRequestCookiesTest.php.

Member Function Documentation

◆ it_gets_cookies()

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

Definition at line 10 of file FigRequestCookiesTest.php.

References $request, Dflydev\FigCookies\Cookies\COOKIE_HEADER, Dflydev\FigCookies\FigRequestCookies\get(), and Dflydev\FigCookies\withHeader().

11  {
12  $request = (new FigCookieTestingRequest())
13  ->withHeader(Cookies::COOKIE_HEADER, 'theme=light; sessionToken=RAPELCGRQ; hello=world')
14  ;
15 
16  $this->assertEquals(
17  'RAPELCGRQ',
18  FigRequestCookies::get($request, 'sessionToken')->getValue()
19  );
20  }
static get(RequestInterface $request, $name, $value=null)
foreach($paths as $path) $request
Definition: asyncclient.php:32
const COOKIE_HEADER
The name of the Cookie header.
Definition: Cookies.php:12
+ Here is the call graph for this function:

◆ it_modifies_cookies()

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

Definition at line 42 of file FigRequestCookiesTest.php.

References $request, Dflydev\FigCookies\Cookies\COOKIE_HEADER, Dflydev\FigCookies\Cookie\getName(), Dflydev\FigCookies\FigRequestCookies\modify(), Dflydev\FigCookies\withHeader(), and Dflydev\FigCookies\Cookie\withValue().

43  {
44  $request = (new FigCookieTestingRequest())
45  ->withHeader(Cookies::COOKIE_HEADER, 'theme=light; sessionToken=RAPELCGRQ; hello=world')
46  ;
47 
48  $request = FigRequestCookies::modify($request, 'hello', function (Cookie $cookie) {
49  return $cookie->withValue(strtoupper($cookie->getName()));
50  });
51 
52  $this->assertEquals(
53  'theme=light; sessionToken=RAPELCGRQ; hello=HELLO',
54  $request->getHeaderLine('Cookie')
55  );
56  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
const COOKIE_HEADER
The name of the Cookie header.
Definition: Cookies.php:12
static modify(RequestInterface $request, $name, $modify)
+ Here is the call graph for this function:

◆ it_removes_cookies()

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

Definition at line 61 of file FigRequestCookiesTest.php.

References $request, Dflydev\FigCookies\Cookies\COOKIE_HEADER, Dflydev\FigCookies\FigRequestCookies\remove(), and Dflydev\FigCookies\withHeader().

62  {
63  $request = (new FigCookieTestingRequest())
64  ->withHeader(Cookies::COOKIE_HEADER, 'theme=light; sessionToken=RAPELCGRQ; hello=world')
65  ;
66 
67  $request = FigRequestCookies::remove($request, 'sessionToken');
68 
69  $this->assertEquals(
70  'theme=light; hello=world',
71  $request->getHeaderLine('Cookie')
72  );
73  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
const COOKIE_HEADER
The name of the Cookie header.
Definition: Cookies.php:12
static remove(RequestInterface $request, $name)
+ Here is the call graph for this function:

◆ it_sets_cookies()

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

Definition at line 25 of file FigRequestCookiesTest.php.

References $request, Dflydev\FigCookies\Cookies\COOKIE_HEADER, Dflydev\FigCookies\Cookie\create(), Dflydev\FigCookies\FigRequestCookies\set(), and Dflydev\FigCookies\withHeader().

26  {
27  $request = (new FigCookieTestingRequest())
28  ->withHeader(Cookies::COOKIE_HEADER, 'theme=light; sessionToken=RAPELCGRQ; hello=world')
29  ;
30 
32 
33  $this->assertEquals(
34  'theme=light; sessionToken=RAPELCGRQ; hello=WORLD%21',
35  $request->getHeaderLine('Cookie')
36  );
37  }
static create($name, $value=null)
Create a Cookie.
Definition: Cookie.php:73
foreach($paths as $path) $request
Definition: asyncclient.php:32
const COOKIE_HEADER
The name of the Cookie header.
Definition: Cookies.php:12
static set(RequestInterface $request, Cookie $cookie)
+ Here is the call graph for this function:

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