aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/security
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-05-22 11:02:56 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commitaf290059d10319e76d1e7d78b592cab99c26d91a (patch)
treeb088526052182d4b4f3c0af20db89f7d28fc3d9a /tests/security
parent893f5159c64e5bcff505c8367e6dc22cc2a7b14d (diff)
downloadShaarli-af290059d10319e76d1e7d78b592cab99c26d91a.tar.gz
Shaarli-af290059d10319e76d1e7d78b592cab99c26d91a.tar.zst
Shaarli-af290059d10319e76d1e7d78b592cab99c26d91a.zip
Process session filters through Slim controllers
Including: - visibility - links per page - untagged only
Diffstat (limited to 'tests/security')
-rw-r--r--tests/security/SessionManagerTest.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/security/SessionManagerTest.php b/tests/security/SessionManagerTest.php
index f264505e..d9db775e 100644
--- a/tests/security/SessionManagerTest.php
+++ b/tests/security/SessionManagerTest.php
@@ -269,4 +269,61 @@ class SessionManagerTest extends TestCase
269 $this->session['ip'] = 'ip_id_one'; 269 $this->session['ip'] = 'ip_id_one';
270 $this->assertTrue($this->sessionManager->hasClientIpChanged('ip_id_two')); 270 $this->assertTrue($this->sessionManager->hasClientIpChanged('ip_id_two'));
271 } 271 }
272
273 /**
274 * Test creating an entry in the session array
275 */
276 public function testSetSessionParameterCreate(): void
277 {
278 $this->sessionManager->setSessionParameter('abc', 'def');
279
280 static::assertSame('def', $this->session['abc']);
281 }
282
283 /**
284 * Test updating an entry in the session array
285 */
286 public function testSetSessionParameterUpdate(): void
287 {
288 $this->session['abc'] = 'ghi';
289
290 $this->sessionManager->setSessionParameter('abc', 'def');
291
292 static::assertSame('def', $this->session['abc']);
293 }
294
295 /**
296 * Test updating an entry in the session array with null value
297 */
298 public function testSetSessionParameterUpdateNull(): void
299 {
300 $this->session['abc'] = 'ghi';
301
302 $this->sessionManager->setSessionParameter('abc', null);
303
304 static::assertArrayHasKey('abc', $this->session);
305 static::assertNull($this->session['abc']);
306 }
307
308 /**
309 * Test deleting an existing entry in the session array
310 */
311 public function testDeleteSessionParameter(): void
312 {
313 $this->session['abc'] = 'def';
314
315 $this->sessionManager->deleteSessionParameter('abc');
316
317 static::assertArrayNotHasKey('abc', $this->session);
318 }
319
320 /**
321 * Test deleting a non existent entry in the session array
322 */
323 public function testDeleteSessionParameterNotExisting(): void
324 {
325 $this->sessionManager->deleteSessionParameter('abc');
326
327 static::assertArrayNotHasKey('abc', $this->session);
328 }
272} 329}