ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\HTTP\Cookies\CookieWrapperTest Class Reference

Class CookieWrapperTest. More...

+ Inheritance diagram for ILIAS\HTTP\Cookies\CookieWrapperTest:
+ Collaboration diagram for ILIAS\HTTP\Cookies\CookieWrapperTest:

Public Member Functions

 testWithValueDoesNotChangeTheCurrentObject ()
 
 testWithExpiresDoesNotChangeTheCurrentObject ()
 
 testRememberForeverDoesNotChangeTheCurrentObject ()
 
 testExpireDoesNotChangeTheCurrentObject ()
 
 testWithMaxAgeDoesNotChangeTheCurrentObject ()
 
 testWithPathDoesNotChangeTheCurrentObject ()
 
 testWithDomainDoesNotChangeTheCurrentObject ()
 
 testWithSecureDoesNotChangeTheCurrentObject ()
 
 testWithHttpOnlyDoesNotChangeTheCurrentObject ()
 

Static Public Member Functions

static setUpBeforeClass ()
 

Protected Member Functions

 setUp ()
 

Private Attributes

 $cookie
 

Static Private Attributes

static $cookieFactory
 

Detailed Description

Class CookieWrapperTest.

Author
Nicolas Schäfli ns@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

disabled disabled disabled

Definition at line 24 of file CookieWrapperTest.php.

Member Function Documentation

◆ setUp()

ILIAS\HTTP\Cookies\CookieWrapperTest::setUp ( )
protected

Definition at line 44 of file CookieWrapperTest.php.

44  : void
45  {
46  parent::setUp();
47 
48  //setup the cookie we want to use for our tests.
49  $cookieName = "ilias";
50  $cookieValue = "theNewCookiesAreYummy";
51  $this->cookie = self::$cookieFactory->create($cookieName, $cookieValue);
52  }

◆ setUpBeforeClass()

static ILIAS\HTTP\Cookies\CookieWrapperTest::setUpBeforeClass ( )
static

Definition at line 37 of file CookieWrapperTest.php.

37  : void
38  {
39  parent::setUpBeforeClass();
40  self::$cookieFactory = new CookieFactoryImpl();
41  }

◆ testExpireDoesNotChangeTheCurrentObject()

ILIAS\HTTP\Cookies\CookieWrapperTest::testExpireDoesNotChangeTheCurrentObject ( )

Definition at line 95 of file CookieWrapperTest.php.

96  {
97  $newCookie = $this->cookie->expire();
98 
99  //expire changes the date of expiry so they should differ by quite a bit.
100  $this->assertNotEquals($this->cookie->getExpires(), $newCookie->getExpires());
101  }

◆ testRememberForeverDoesNotChangeTheCurrentObject()

ILIAS\HTTP\Cookies\CookieWrapperTest::testRememberForeverDoesNotChangeTheCurrentObject ( )

Definition at line 83 of file CookieWrapperTest.php.

84  {
85  $newCookie = $this->cookie->rememberForLongTime();
86 
87  //remember forever changes the date of expiry so they should differ by quite a bit.
88  $this->assertNotEquals($this->cookie->getExpires(), $newCookie->getExpires());
89  }

◆ testWithDomainDoesNotChangeTheCurrentObject()

ILIAS\HTTP\Cookies\CookieWrapperTest::testWithDomainDoesNotChangeTheCurrentObject ( )

Definition at line 133 of file CookieWrapperTest.php.

134  {
135  $domain = 'ilias.de';
136  $newCookie = $this->cookie->withDomain($domain);
137 
138  $this->assertEquals($domain, $newCookie->getDomain());
139  $this->assertNotEquals($this->cookie->getDomain(), $newCookie->getDomain());
140  }

◆ testWithExpiresDoesNotChangeTheCurrentObject()

ILIAS\HTTP\Cookies\CookieWrapperTest::testWithExpiresDoesNotChangeTheCurrentObject ( )

Definition at line 70 of file CookieWrapperTest.php.

71  {
72  $expires = 1000;
73  $newCookie = $this->cookie->withExpires($expires);
74 
75  $this->assertEquals($expires, $newCookie->getExpires());
76  $this->assertNotEquals($this->cookie->getExpires(), $newCookie->getExpires());
77  }

◆ testWithHttpOnlyDoesNotChangeTheCurrentObject()

ILIAS\HTTP\Cookies\CookieWrapperTest::testWithHttpOnlyDoesNotChangeTheCurrentObject ( )

Definition at line 159 of file CookieWrapperTest.php.

160  {
161  $httpOnly = true;
162  $newCookie = $this->cookie->withHttpOnly($httpOnly);
163 
164  $this->assertTrue($newCookie->getHttpOnly());
165  $this->assertNotEquals($this->cookie->getHttpOnly(), $newCookie->getHttpOnly());
166  }

◆ testWithMaxAgeDoesNotChangeTheCurrentObject()

ILIAS\HTTP\Cookies\CookieWrapperTest::testWithMaxAgeDoesNotChangeTheCurrentObject ( )

Definition at line 107 of file CookieWrapperTest.php.

108  {
109  $maxAge = 1000;
110  $newCookie = $this->cookie->withMaxAge($maxAge);
111 
112  $this->assertEquals($maxAge, $newCookie->getMaxAge());
113  $this->assertNotEquals($this->cookie->getMaxAge(), $newCookie->getMaxAge());
114  }

◆ testWithPathDoesNotChangeTheCurrentObject()

ILIAS\HTTP\Cookies\CookieWrapperTest::testWithPathDoesNotChangeTheCurrentObject ( )

Definition at line 120 of file CookieWrapperTest.php.

121  {
122  $path = '/ilias';
123  $newCookie = $this->cookie->withPath($path);
124 
125  $this->assertEquals($path, $newCookie->getPath());
126  $this->assertNotEquals($this->cookie->getPath(), $newCookie->getPath());
127  }

◆ testWithSecureDoesNotChangeTheCurrentObject()

ILIAS\HTTP\Cookies\CookieWrapperTest::testWithSecureDoesNotChangeTheCurrentObject ( )

Definition at line 146 of file CookieWrapperTest.php.

147  {
148  $secure = true;
149  $newCookie = $this->cookie->withSecure($secure);
150 
151  $this->assertTrue($newCookie->getSecure());
152  $this->assertNotEquals($this->cookie->getSecure(), $newCookie->getSecure());
153  }

◆ testWithValueDoesNotChangeTheCurrentObject()

ILIAS\HTTP\Cookies\CookieWrapperTest::testWithValueDoesNotChangeTheCurrentObject ( )

Definition at line 58 of file CookieWrapperTest.php.

59  {
60  $newValue = "yes!";
61  $newCookie = $this->cookie->withValue("yes!");
62  $this->assertEquals($newValue, $newCookie->getValue());
63  $this->assertNotEquals($this->cookie->getValue(), $newCookie->getValue());
64  }

Field Documentation

◆ $cookie

CookieWrapper ILIAS\HTTP\Cookies\CookieWrapperTest::$cookie
private

Definition at line 30 of file CookieWrapperTest.php.

◆ $cookieFactory

CookieFactory ILIAS\HTTP\Cookies\CookieWrapperTest::$cookieFactory
staticprivate

Definition at line 34 of file CookieWrapperTest.php.


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