27use PHPUnit\Framework\Attributes\BackupGlobals;
28use PHPUnit\Framework\Attributes\BackupStaticProperties;
29use PHPUnit\Framework\Attributes\PreserveGlobalState;
30use PHPUnit\Framework\Attributes\RunInSeparateProcess;
31use PHPUnit\Framework\Attributes\Test;
32use PHPUnit\Framework\TestCase;
39#[BackupGlobals(false)]
40#[BackupStaticProperties(false)]
41#[PreserveGlobalState(false)]
53 parent::setUpBeforeClass();
58 protected function setUp(): void
63 $cookieName =
"ilias";
64 $cookieValue =
"theNewCookiesAreYummy";
65 $this->cookie = self::$cookieFactory->create($cookieName, $cookieValue);
73 $newCookie = $this->cookie->withValue(
"yes!");
74 $this->assertSame($newValue, $newCookie->getValue());
75 $this->assertNotEquals($this->cookie->getValue(), $newCookie->getValue());
83 $newCookie = $this->cookie->withExpires($expires);
85 $this->assertSame($expires, $newCookie->getExpires());
86 $this->assertNotSame($this->cookie->getExpires(), $newCookie->getExpires());
93 $newCookie = $this->cookie->rememberForLongTime();
96 $this->assertNotSame($this->cookie->getExpires(), $newCookie->getExpires());
103 $newCookie = $this->cookie->expire();
106 $this->assertNotSame($this->cookie->getExpires(), $newCookie->getExpires());
114 $newCookie = $this->cookie->withMaxAge($maxAge);
116 $this->assertSame($maxAge, $newCookie->getMaxAge());
117 $this->assertNotSame($this->cookie->getMaxAge(), $newCookie->getMaxAge());
125 $newCookie = $this->cookie->withPath(
$path);
127 $this->assertSame(
$path, $newCookie->getPath());
128 $this->assertNotEquals($this->cookie->getPath(), $newCookie->getPath());
135 $domain =
'ilias.de';
136 $newCookie = $this->cookie->withDomain($domain);
138 $this->assertSame($domain, $newCookie->getDomain());
139 $this->assertNotEquals($this->cookie->getDomain(), $newCookie->getDomain());
147 $newCookie = $this->cookie->withSecure($secure);
149 $this->assertTrue($newCookie->getSecure());
150 $this->assertNotSame($this->cookie->getSecure(), $newCookie->getSecure());
158 $newCookie = $this->cookie->withHttpOnly($httpOnly);
160 $this->assertTrue($newCookie->getHttpOnly());
161 $this->assertNotSame($this->cookie->getHttpOnly(), $newCookie->getHttpOnly());
testExpireDoesNotChangeTheCurrentObject()
testWithDomainDoesNotChangeTheCurrentObject()
testWithExpiresDoesNotChangeTheCurrentObject()
testWithSecureDoesNotChangeTheCurrentObject()
testRememberForeverDoesNotChangeTheCurrentObject()
testWithHttpOnlyDoesNotChangeTheCurrentObject()
static CookieFactoryImpl $cookieFactory
static setUpBeforeClass()
testWithMaxAgeDoesNotChangeTheCurrentObject()
testWithValueDoesNotChangeTheCurrentObject()
testWithPathDoesNotChangeTheCurrentObject()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...