ILIAS  release_8 Revision v8.24
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 ()
 @Test More...
 
 testWithExpiresDoesNotChangeTheCurrentObject ()
 @Test More...
 
 testRememberForeverDoesNotChangeTheCurrentObject ()
 @Test More...
 
 testExpireDoesNotChangeTheCurrentObject ()
 @Test More...
 
 testWithMaxAgeDoesNotChangeTheCurrentObject ()
 @Test More...
 
 testWithPathDoesNotChangeTheCurrentObject ()
 @Test More...
 
 testWithDomainDoesNotChangeTheCurrentObject ()
 @Test More...
 
 testWithSecureDoesNotChangeTheCurrentObject ()
 @Test More...
 
 testWithHttpOnlyDoesNotChangeTheCurrentObject ()
 @Test More...
 

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

@runInSeparateProcess @preserveGlobalState disabled @backupGlobals disabled @backupStaticAttributes disabled

Definition at line 35 of file CookieWrapperTest.php.

Member Function Documentation

◆ setUp()

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

Definition at line 54 of file CookieWrapperTest.php.

54 : void
55 {
56 parent::setUp();
57
58 //setup the cookie we want to use for our tests.
59 $cookieName = "ilias";
60 $cookieValue = "theNewCookiesAreYummy";
61 $this->cookie = self::$cookieFactory->create($cookieName, $cookieValue);
62 }

◆ setUpBeforeClass()

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

Definition at line 47 of file CookieWrapperTest.php.

47 : void
48 {
49 parent::setUpBeforeClass();
50 self::$cookieFactory = new CookieFactoryImpl();
51 }

◆ testExpireDoesNotChangeTheCurrentObject()

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

@Test

Definition at line 105 of file CookieWrapperTest.php.

106 {
107 $newCookie = $this->cookie->expire();
108
109 //expire changes the date of expiry so they should differ by quite a bit.
110 $this->assertNotEquals($this->cookie->getExpires(), $newCookie->getExpires());
111 }

◆ testRememberForeverDoesNotChangeTheCurrentObject()

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

@Test

Definition at line 93 of file CookieWrapperTest.php.

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

◆ testWithDomainDoesNotChangeTheCurrentObject()

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

@Test

Definition at line 143 of file CookieWrapperTest.php.

144 {
145 $domain = 'ilias.de';
146 $newCookie = $this->cookie->withDomain($domain);
147
148 $this->assertEquals($domain, $newCookie->getDomain());
149 $this->assertNotEquals($this->cookie->getDomain(), $newCookie->getDomain());
150 }

◆ testWithExpiresDoesNotChangeTheCurrentObject()

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

@Test

Definition at line 80 of file CookieWrapperTest.php.

81 {
82 $expires = 1000;
83 $newCookie = $this->cookie->withExpires($expires);
84
85 $this->assertEquals($expires, $newCookie->getExpires());
86 $this->assertNotEquals($this->cookie->getExpires(), $newCookie->getExpires());
87 }

◆ testWithHttpOnlyDoesNotChangeTheCurrentObject()

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

@Test

Definition at line 169 of file CookieWrapperTest.php.

170 {
171 $httpOnly = true;
172 $newCookie = $this->cookie->withHttpOnly($httpOnly);
173
174 $this->assertTrue($newCookie->getHttpOnly());
175 $this->assertNotEquals($this->cookie->getHttpOnly(), $newCookie->getHttpOnly());
176 }

◆ testWithMaxAgeDoesNotChangeTheCurrentObject()

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

@Test

Definition at line 117 of file CookieWrapperTest.php.

118 {
119 $maxAge = 1000;
120 $newCookie = $this->cookie->withMaxAge($maxAge);
121
122 $this->assertEquals($maxAge, $newCookie->getMaxAge());
123 $this->assertNotEquals($this->cookie->getMaxAge(), $newCookie->getMaxAge());
124 }

◆ testWithPathDoesNotChangeTheCurrentObject()

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

@Test

Definition at line 130 of file CookieWrapperTest.php.

131 {
132 $path = '/ilias';
133 $newCookie = $this->cookie->withPath($path);
134
135 $this->assertEquals($path, $newCookie->getPath());
136 $this->assertNotEquals($this->cookie->getPath(), $newCookie->getPath());
137 }
$path
Definition: ltiservices.php:32

References $path.

◆ testWithSecureDoesNotChangeTheCurrentObject()

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

@Test

Definition at line 156 of file CookieWrapperTest.php.

157 {
158 $secure = true;
159 $newCookie = $this->cookie->withSecure($secure);
160
161 $this->assertTrue($newCookie->getSecure());
162 $this->assertNotEquals($this->cookie->getSecure(), $newCookie->getSecure());
163 }

◆ testWithValueDoesNotChangeTheCurrentObject()

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

@Test

Definition at line 68 of file CookieWrapperTest.php.

69 {
70 $newValue = "yes!";
71 $newCookie = $this->cookie->withValue("yes!");
72 $this->assertEquals($newValue, $newCookie->getValue());
73 $this->assertNotEquals($this->cookie->getValue(), $newCookie->getValue());
74 }

Field Documentation

◆ $cookie

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

Definition at line 40 of file CookieWrapperTest.php.

◆ $cookieFactory

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

Definition at line 44 of file CookieWrapperTest.php.


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