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

Public Member Functions

 it_parses_one_from_cookie_string ($cookieString, $expectedName, $expectedValue)
 
 it_parses_list_from_cookie_string ($cookieString, array $expectedNameValuePairs)
 
 provideParsesOneFromCookieStringData ()
 
 provideParsesListFromCookieString ()
 

Private Member Functions

 assertCookieNameAndValue (Cookie $cookie, $expectedName, $expectedValue)
 

Detailed Description

Definition at line 5 of file CookieTest.php.

Member Function Documentation

◆ assertCookieNameAndValue()

Dflydev\FigCookies\CookieTest::assertCookieNameAndValue ( Cookie  $cookie,
  $expectedName,
  $expectedValue 
)
private

Definition at line 36 of file CookieTest.php.

References Dflydev\FigCookies\Cookie\getName(), and Dflydev\FigCookies\Cookie\getValue().

Referenced by Dflydev\FigCookies\CookieTest\it_parses_list_from_cookie_string(), and Dflydev\FigCookies\CookieTest\it_parses_one_from_cookie_string().

37  {
38  $this->assertEquals($expectedName, $cookie->getName());
39  $this->assertEquals($expectedValue, $cookie->getValue());
40  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ it_parses_list_from_cookie_string()

Dflydev\FigCookies\CookieTest::it_parses_list_from_cookie_string (   $cookieString,
array  $expectedNameValuePairs 
)
Test:
provideParsesListFromCookieString

Definition at line 22 of file CookieTest.php.

References $i, Dflydev\FigCookies\CookieTest\assertCookieNameAndValue(), and Dflydev\FigCookies\Cookie\listFromCookieString().

23  {
24  $cookies = Cookie::listFromCookieString($cookieString);
25 
26  $this->assertCount(count($expectedNameValuePairs), $cookies);
27 
28  for ($i = 0; $i < count($cookies); $i++) {
29  $cookie = $cookies[$i];
30  list ($expectedName, $expectedValue) = $expectedNameValuePairs[$i];
31 
32  $this->assertCookieNameAndValue($cookie, $expectedName, $expectedValue);
33  }
34  }
static listFromCookieString($string)
Create a list of Cookies from a Cookie header value string.
Definition: Cookie.php:84
assertCookieNameAndValue(Cookie $cookie, $expectedName, $expectedValue)
Definition: CookieTest.php:36
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ it_parses_one_from_cookie_string()

Dflydev\FigCookies\CookieTest::it_parses_one_from_cookie_string (   $cookieString,
  $expectedName,
  $expectedValue 
)
Test:
provideParsesOneFromCookieStringData

Definition at line 11 of file CookieTest.php.

References Dflydev\FigCookies\CookieTest\assertCookieNameAndValue().

12  {
13  $cookie = Cookie::oneFromCookiePair($cookieString);
14 
15  $this->assertCookieNameAndValue($cookie, $expectedName, $expectedValue);
16  }
assertCookieNameAndValue(Cookie $cookie, $expectedName, $expectedValue)
Definition: CookieTest.php:36
+ Here is the call graph for this function:

◆ provideParsesListFromCookieString()

Dflydev\FigCookies\CookieTest::provideParsesListFromCookieString ( )

Definition at line 51 of file CookieTest.php.

52  {
53  return [
54  ['theme=light; sessionToken=abc123', [
55  ['theme', 'light'],
56  ['sessionToken', 'abc123'],
57  ]],
58 
59  ['theme=light; sessionToken=abc123;', [
60  ['theme', 'light'],
61  ['sessionToken', 'abc123'],
62  ]],
63  ];
64  }

◆ provideParsesOneFromCookieStringData()

Dflydev\FigCookies\CookieTest::provideParsesOneFromCookieStringData ( )

Definition at line 42 of file CookieTest.php.

43  {
44  return [
45  ['someCookie=something', 'someCookie', 'something'],
46  ['hello%3Dworld=how%22are%27you', 'hello=world', 'how"are\'you'],
47  ['empty=', 'empty', ''],
48  ];
49  }

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